1 Reply Latest reply on Jan 23, 2020 5:37 PM by Gatormain

    Eloqua REST API

    RohitAbburi

      Is it possible to Map a custom object record upon creating it using curl?

       

      $body = '{
        "type": "CustomObjectData",
        "fieldValues": [
        {
        "id": "513",
        "value": "enquirer@gmail.com"
        },
        {
        "id": "501",
        "value": "12"
        }
        ],
        "isMapped": "true"
      }';
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, "$baseURL/API/REST/2.0/data/customobject/{id}/instance");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Authorization: "));
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
      $result = curl_exec($ch);

       

       

      the above code creates a custom object record but does not Map it with the contact.

      Any inputs are appreciated. TIA  Code It Do ItOracle AppCloud

        • 1. Re: Eloqua REST API
          Gatormain

          instead of isMapped, you need to pass contactId

           

          If, enquirer@gmail.com contact id is 1

           

          $body = '{

            "type": "CustomObjectData",

            "fieldValues": [

            {

            "id": "513",

            "value": "enquirer@gmail.com"

            },

            {

            "id": "501",

            "value": "12"

            }

            ],

            "contactId ": "1"

          }';

           

          it should return a "isMapped": "Yes"

           

          Which means you will have to check if there is a contact to get their ID. If one doesn't exist, create and use that id.

           

          Or you could use Custom Object Record Services, Processing Step 'Save to Contact Table' to do the mapping instead of using the API