0

API request to insert strings in DE returns 10004 error. As I understand it is related to incorrect usage of brackets I tried various combinations but it still does not work:

endpoint:

https://mc9jm4wv8jc5tqpqwr18x38-t7km.rest.marketingcloudapis.com/hub/v1/dataeventsasync/key:DB57888D-5E26-48DD-B954-F89523D0E315/rowset

body:

    {
        "items": [{
            "PersonId":"sampleId",
            "ActivityCode" : "sample_string",
            "ActivityDate": "12/12/12",
            "ActivitySource": "sample_string"
    }]
}

return error:

{
    "message": "JSON Deserialization Exception: Location Unknown",
    "errorcode": 10004,
    "documentation": ""
}

}

2
  • 1
    Are you sure your endpoint is correct? In the documentation endpoint looks like ending with /rows not /rowset for async
    – tugce
    Jun 11, 2019 at 10:21
  • @tugce is right. In the documentation, the displayed endpoint for async insert is different /data/v1/async/dataextensions/{id}/rows, but doing a call to get the possible endpoints for hub, I see this endpoint does exist: /hub/v1/dataeventsasync/key:{key}/rowset. Instead of 'items', I would copy the payload of the sync - using 'key' and 'value' objects and see if that will resolve your issue. Or use the other documented endpoint Jun 11, 2019 at 12:50

2 Answers 2

3

It looks like you are using the undocumented async version of the sync endpoint.

The async endpoint given in the documentation is: /data/v1/async/dataextensions/{id}/rows

This is the endpoint that requires the 'items' payload, like what you have.

{
        "items": [{
            "PersonId":"sampleId",
            "ActivityCode" : "sample_string",
            "ActivityDate": "12/12/12",
            "ActivitySource": "sample_string"
    }]
}

But since you are using an undocumented, but valid, endpoint (/hub/v1/dataeventsasync/key:{key}/rowset), you need to use the same payload as the sync version with 'Key" and 'Values', not 'Items'.

[
    {
        "keys":{
                "Email": "[email protected]"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "John",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    },
    {
        "keys": {
                "Email": "[email protected]"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "Jane",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    }
]

Once you change the payload (or the endpoint), the error goes away and it successfully inserts the records. Do note however that the returned payload on the dataeventsasync endpoint is literally an empty string (""). I assume this is because the endpoint is undocumented and therefore not officially supported/completed.

0

You are missing a closing } at the end of the request body.

You can use a JSON Formatter to validate your JSON.

1
  • Yes, you're right. But it was just inaccurate copy-paste, I fixed it and it still returns the same error. Jun 11, 2019 at 8:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .