[SalesForce] Upserts a data extension row using Rest Api

When I am try to insert data into a data extension using REST API I'm getting an error.

Api Doc:
https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/putDataExtensionRowByKey.htm

Put Url :
https://www.exacttargetapis.com/hub/v1/dataeventsasync/key:4D58A264-3B49-44C4-A350-14D2D0A7D39B/rows/CustomerID:123

Post Data:

{
    "values":{
            "Interest":"1et.com"
             }
}

In the Header I provide AccessToken.

Response is:

{
    "message": "Primary key 'CustomerID' does not exist.",
    "errorcode": 10000,
    "documentation": ""
}

But I have CustomerID as a Primary Key on that Data Extension

enter image description here

Total Records In DE:
enter image description here

Best Answer

It looks like there are no value "123" (from your request) in the Column "CustomerID". According to documentation this is "Upsert" operations which means like "update and insert". Can you try to do Asynchronous Insert Operation - https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/insertDataExtensionIDAsync.htm I hope it helps you in the issue.

Related Topic