3

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.

  • what's the value of your Data Extension's customer/external key? You'll need to replace external_key_of_DE_here with that value. – Adam Spriggs Jan 24 '18 at 22:42
  • Is field Email use the "EmailAddress" datatype. I wonder if "test@test.com" if failing List Detective and therefore won't insert. – David Devoy Jan 24 '18 at 22:55
  • @AdamSpriggs external_key_of_DE_here is just a replacement for the key i have. – findev Jan 25 '18 at 16:54
  • @DavidDevoy field Email is datatype EmailAddress. – findev Jan 25 '18 at 17:15
  • 2
    @Gortonington the dataevent works indeed, but the problem is that that call requires the DE to have a primary key which is not the case with the DE i am working with. – findev Jan 25 '18 at 20:20
1

@findev

try formatting your url to: https://www.exacttargetapis.com/data/v1/async/dataextensions/key:external_key_of_DE_here/rows

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.