0

How do I update only some columns of my DE leaving other columns as they are using primary key with the help of REST API call?

1

I believe the call you are looking for is PUT /data/v1/async/dataextensions/{id}/rows. This will let you upsert data into the corresponding DE (via ID or Key) utilizing the REST API.

Asynchronously upsert data into an identified data extension by id or key, where id is the unique identifier of the data extension and key is the external key (customer key) of the data extension. We limit these resources to accounts that are enabled via a custom setting. Marketing Cloud can enable this setting at the enterprise, account, or custom object level. Reach out to your account representative to enable these resources in your account.

Note the warning above that this may need to be enabled by SFMC and that they reserve the right to limit resources associated with this call.

Items(data to fill into DE) must be inside of JSON format.

Example Call:

Host: https://www.exacttargetapis.com
PUT /data/v1/async/dataextensions/key:ExternalKey12345/rows
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

{
   "items": [{
      "FirstName":"Bobby",
      "LastName" : "Jones",
      "ZipCode": "23456"
   },
   {
      "FirstName":"Sam",
      "LastName" : "Sneed",
      "ZipCode": "23456"
   }]
}

or if you do not need async (thanks @LukasLunow for pointing this out) - you can use the sync version instead.

Example call:

Host: https://www.exacttargetapis.com
POST /hub/v1/dataevents/11954DDF-28A3-4FE8-BF77-646C37506621/rowset
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

[
    {
        "keys":{
                "Email": "someone@example.com"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "John",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    },
    {
        "keys": {
                "Email": "someone2@example.com"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "Jane",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    }
]

In response to your comment below, for the async - this seems correct. But if you want to do the sync version, the format must be listed with the Key section, see below:

{
        "keys":{
                "Email": "someone@example.com"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "John",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    }
  • Thank You @Gortonington . So in my case, the External Key for my DE is "abc" and I need to update a row where a column named "PrimaryKey" has value "test1". So my call will look something like this: Host: exacttargetapis.com PUT /data/v1/async/dataextensions/key:abc/rows Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN { "items": [{ "FirstName":"Bobby", "PrimaryKey" : "test1" }] } – Krati Garg Oct 3 '18 at 4:12
  • Is my understanding correct? So basically all I want to do is update "FirstName" field where the value of "PrimaryKey" field is "test1". Please point out where is my call wrong. Thanks. – Krati Garg Oct 3 '18 at 4:13
  • I am getting this error: "Invalid request, this operation has not been enabled for this Account or Data Extension." Does this mean I need to raise a case with Salesforce Support? – Krati Garg Oct 3 '18 at 6:58
  • 1
    You should reach out to Salesforce to enable the async approach - in the meantime you can use the synchronous approach: developer.salesforce.com/docs/… – Lukas Lunow Oct 3 '18 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.