Discussions

CDO Account/contact Mapping via API

10686561068656 Posts: 9
edited October 2016 in Dream It

Request is to be able to map a CDO to either a contact or an account record (priority is with accounts, as there is a work around via triggering a form submit to link to contacts) via API. Currently the only way for an account to be linked to a CDO is manual linkage, or through the upload wizard within the CDO section.

Post edited by Unknown User on
4
4 votes

Already offered · Last Updated

Comments

  • Lou PatrickLou Patrick Posts: 343 Gold Badge
    edited July 28

    The ability to map Custom Object records is currently available using the Application API and the Bulk API.

    Application API (Contacts only):

        Endpoint: Create custom object data

        Example request creating a new Custom Object record for a Custom Object with an id of 14, and mapping the record to a Contact record with the id of 1:

              Request

    POST  /api/REST/2.0/data/customObject/14/instance

              Request - Body

    {  "type": "CustomObjectData",  "contactId": "1",  "fieldValues": [    {      "id": "107",      "value": "[email protected]"    }  ]}

              Response

    {  "type": "CustomObjectData",  "id": "31",  "contactId": "1",  "fieldValues": [    {      "id": "107",      "value": "[email protected]"    }  ]}

              Note, I confirmed Custom Object record was successfully mapped to Contact in Eloqua.

    Bulk API (Contacts and Accounts):

        Endpoints and Tutorial:

        Example import definition request to import Custom Object records for a Custom Object with an id of 14, and map them to Account records using the Company Name Account field:

              Request

    POST /api/bulk/2.0/customObjects/14/imports

              Request - Body

    {  "name": "Map to Accounts Import",  "fields": {    "email": "{{CustomObject[14].Field[107]}}",    "companyName": "{{CustomObject[14].Field[108]}}"   },  "identifierFieldName": "email",  "mapDataCards": true,  "mapDataCardsEntityType": "Company",  "mapDataCardsEntityField": "{{Account.Field(M_CompanyName)}}",  "mapDataCardsSourceField": "companyName",  "mapDataCardsCaseSensitiveMatch": false}

              Response

    {  "id": 20,  "parentId": 14,  "mapDataCards": true,  "mapDataCardsCaseSensitiveMatch": false,  "mapDataCardsEntityField": "{{Account.Field(M_CompanyName)}}",  "mapDataCardsSourceField": "companyName",  "mapDataCardsEntityType": "Company",  "name": "Map to Accounts Import",  "fields": {    "email": "{{CustomObject[14].Field[107]}}",    "companyName": "{{CustomObject[14].Field[108]}}"  },  "identifierFieldName": "email",  "isSyncTriggeredOnImport": false,  "dataRetentionDuration": "P7D",  "isUpdatingMultipleMatchedRecords": false,  "uri": "/customObjects/14/imports/20",  "createdBy": "Lou.Patrick",  "createdAt": "2016-07-29T22:13:27.9841117Z",  "updatedBy": "Lou.Patrick",  "updatedAt": "2016-07-29T22:13:27.9841117Z"}

              I've validated this import definition by uploading data, syncing data, and confirming mapping was successful. If there is interest in a full walkthrough let me know, and I'll create a separate post.

    Post edited by Unknown User on
  • KyleDKyleD Posts: 1

    The ability to map Custom Object records is currently available using the Application API and the Bulk API.

    Application API (Contacts only):

        Endpoint: Create custom object data

        Example request creating a new Custom Object record for a Custom Object with an id of 14, and mapping the record to a Contact record with the id of 1:

              Request

    POST  /api/REST/2.0/data/customObject/14/instance

              Request - Body

    {  "type": "CustomObjectData",  "contactId": "1",  "fieldValues": [    {      "id": "107",      "value": "[email protected]"    }  ]}

              Response

    {  "type": "CustomObjectData",  "id": "31",  "contactId": "1",  "fieldValues": [    {      "id": "107",      "value": "[email protected]"    }  ]}

              Note, I confirmed Custom Object record was successfully mapped to Contact in Eloqua.

    Bulk API (Contacts and Accounts):

        Endpoints and Tutorial:

        Example import definition request to import Custom Object records for a Custom Object with an id of 14, and map them to Account records using the Company Name Account field:

              Request

    POST /api/bulk/2.0/customObjects/14/imports

              Request - Body

    {  "name": "Map to Accounts Import",  "fields": {    "email": "{{CustomObject[14].Field[107]}}",    "companyName": "{{CustomObject[14].Field[108]}}"   },  "identifierFieldName": "email",  "mapDataCards": true,  "mapDataCardsEntityType": "Company",  "mapDataCardsEntityField": "{{Account.Field(M_CompanyName)}}",  "mapDataCardsSourceField": "companyName",  "mapDataCardsCaseSensitiveMatch": false}

              Response

    {  "id": 20,  "parentId": 14,  "mapDataCards": true,  "mapDataCardsCaseSensitiveMatch": false,  "mapDataCardsEntityField": "{{Account.Field(M_CompanyName)}}",  "mapDataCardsSourceField": "companyName",  "mapDataCardsEntityType": "Company",  "name": "Map to Accounts Import",  "fields": {    "email": "{{CustomObject[14].Field[107]}}",    "companyName": "{{CustomObject[14].Field[108]}}"  },  "identifierFieldName": "email",  "isSyncTriggeredOnImport": false,  "dataRetentionDuration": "P7D",  "isUpdatingMultipleMatchedRecords": false,  "uri": "/customObjects/14/imports/20",  "createdBy": "Lou.Patrick",  "createdAt": "2016-07-29T22:13:27.9841117Z",  "updatedBy": "Lou.Patrick",  "updatedAt": "2016-07-29T22:13:27.9841117Z"}

              I've validated this import definition by uploading data, syncing data, and confirming mapping was successful. If there is interest in a full walkthrough let me know, and I'll create a separate post.

    Using the REST API, is there a way to map the CDO to a contact via email address only, or is the Contact ID explicitly required?

  • Lou PatrickLou Patrick Posts: 343 Gold Badge

    Using the REST API, is there a way to map the CDO to a contact via email address only, or is the Contact ID explicitly required?

    Using the Application API Contact Id is the only way to map a Custom Object record to a Contact.

  • User_9QN3UUser_9QN3U Posts: 1 Newbie

    Hello. I have created customers and thus have customerId values. I now am needing to add custom data associated with these customers but am running into issues with the POST to add the data.

    Using /api/REST/2.0/assets/customObjects I am able to pull a listing of available custom objects. My particular one has ID 60 with various fields. When I post the following:

    /api/REST/2.0/data/customObject/60/instance

    {

    "type": "CustomObjectData",

    "contactId": "263121",

    "fieldValues": [

    {

    "id": "490",

    "value": "CB-10"

    },

    {

    "id": "491",

    "value": "123123"

    }

    ]

    }

    I get a 404 Object Not Found. 

    Using the 1.0 version /api/REST/1.0/data/customObject/60 posting the same gets me a 400 Validate Error 

    [

    {

    "type": "EndpointParameterError",

    "parameter": "RequiredFieldNotSpecified",

    "value": "<null>"

    }

    ]

    Which is odd as the documentation does not specify required fields. 

    Can someone help with a successful POST to either the 1.0 or 2.0 API to add custom data to a contact?

    Thank you

Sign In or Register to comment.