I'm trying to add a row to a simple data extension with email and name as fields using the following: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/insertDataExtensionIDAsync.htm
I have the following code (accessToken is generated in another function)
var request = require('request');
var options = {
url:"https://www.exacttargetapis.com/data/v1/async/dataextensions/external_key_of_DE_here:key/rows",
method:"POST",
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer '+ accessToken
},
body: '{"items":[{"email":"test@test.com", "name":"test"}]}'
};
request(options, function (error, response, body) {
console.log(response);
});
however, i keep getting an error:
{
"message":"Internal Server Error",
"errorcode":0,
"documentation":"https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm"}
The authentication is working but for some reason nothing is passing through to the DE.
Best Answer
@findev
try formatting your url to: https://www.exacttargetapis.com/data/v1/async/dataextensions/key:external_key_of_DE_here/rows