0

Given a successful authorization, the following API call fails with 500

POST

/contacts/v1/contacts/actions/delete?type=keys

Body:

{    
  "DeleteOperationType" : "ContactAndAttributes",
  "Values" : [ "0031Q00001uEjepQAC" ],
  "ContactTypeId" : 0
}

Response

Callout response
Response Status:Internal Server Error
Response Status Code: 500
Response Body: {
  "message" : "Internal Server Error",
  "errorcode" : 0,
  "documentation" : "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm"
}

Where the documentation link provides this unhelpful suggestion:

Internal Server Error   See the response returned by the HTTP routing assertion.    500
1

There were layers of custom Apex HTTP callout software involved here and it was the first time I had ever used the SFMC API so this took longer to figure out than it should have (and was a rookie mistake)

You need to be sure that you include this in the header:

Content-Type: application/json

I imagine this solution applies to most if not all of the POST or PATCH API requests. Invalid JSON would be another reason. Doc feedback submitted.

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.