Data Extension Rows (Synchronous)

PUT Upsert one row in a data extension synchronously by specifying the ID of the target data extension.

PUT /hub/v1/dataevents/{dataExtensionId}/rows/{primaryKey}:{primaryKeyValue}

Operation ID: upsertRow.

Specify the primary key and value in the URL path. If the target data extension has more than one primary key, specify all the primary keys and values in this format: {primaryKey1}:{primaryKeyValue1},{primaryKey2}:{primaryKeyValue2}....

The API doesn’t accept URLs that contain more than 260 characters. Because character-encoding changes can make URLs longer than expected, we recommend that you limit the length of URLs to 200 characters. If your URL exceeds this recommended limit, use Upsert a Rowset by Using a Data Extension External Key or Upsert a Rowset by Using a Data Extension ID instead. These operations include the primary key in the request body rather than the URL path, making the URL shorter so it stays within the limit.

Parameters

  • Authorization (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace YOUR_ACCESS_TOKEN with your authentication token.

    Example

    Bearer YOUR_ACCESS_TOKEN
  • dataExtensionId (path, string (uuid), required) The unique, system-generated ID for the data extension.
  • primaryKey (path, string, required) The name of a primary key column in the specified data extension.
  • primaryKeyValue (path, string, required) The value of the primary key field in the row to update.

Request body (required)

Media type: application/json. Schema: upsertDataExtensionRowRequestBody.

Responses

  • 200 This response indicates that the request to upsert a row into the data extension succeeded.

    Media type: application/json. Schema: upsertDataExtensionRowResponseBody.

    Example

    {
      "keys": {
        "memberId": "54ce45e4-bd37-4284-bffe-593256ea5bd4"
      },
      "values": {
        "FirstName": "Mary",
        "Surname": "Evans-Smythe",
        "RewardsPoints": 7849,
        "RewardsTier": 1,
        "Area": "Islington"
      }
    }
  • 400 This response indicates that there was a problem with the request. Verify that the ID or external key of the data extension is correct, the name and value of the primary key are valid, and the data types of all fields in the request are correct.

    Media type: application/json. Schema: mceErrorResponseBody.

    Example

    {
      "documentation": "",
      "errorcode": 400,
      "message": "Primary key 'MemberId' does not exist."
    }
  • 401 Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid.

    Media type: application/json. Schema: httpErrorResponseBody.

    Example

    {
      "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm",
      "errorcode": 0,
      "message": "Not Authorized"
    }
  • 403 This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup.

    Media type: application/json. Schema: mceErrorResponseBody.

    Example

    {
      "documentation": "",
      "errorcode": 20002,
      "message": "Insufficient privileges to complete this action."
    }