Every request I make to SFMC's API for contact creation seems to result in a 500. I am following the documentation provided to us and I have included the example requests below. The only thing I could think of is that there is a bug or a permission issue. I can't fathom another reason to respond with a 500.
Note: I am focusing on the contact create/update (upsert if you will) call here and I have tried this same request with a real email and get the same 500 response. Also note that the link they provide in the response is dead smh :/
Attempt – Using /contacts/v1/contacts
Example request:
Host: https://www.exacttargetapis.com
POST /contacts/v1/contacts
Content-Type: application/json
Authorization: Bearer ${AUTH_TOKEN}
{
"contactKey": "local-97005",
"attributeSets": [
{
"name": "Email Addresses",
"items": [
{
"values": [
{
"name": "Email Address",
"value": "[email protected]"
}
]
}
]
}
]
}
Example response:
HTTP 500
{
"message":"Internal Server Error",
"errorcode":0,
"documentation":"https://code.docs.exacttarget.com/rest/errors/500"
}
cURL Request
curl -X POST -H "Authorization: Bearer <token removed for posting>" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 5fd50d70-f8ec-814a-d01b-c15649d24681" -d '{
"contactKey": "local-123452",
"attributeSets": [{
"name": "Email Addresses",
"items": [{
"values": [{
"name": "Email Address",
"value": "[email protected]"
}]
}]
}]
}' "https://www.exacttargetapis.com/contacts/v1/contacts"
EDIT:
Here are data access configurations for the token
Second EDIT
I tried adding HTML Enabled to the request as it is noted as a required field in the documentation, however, I now recieve a 400 Bad Request.
Request
curl -X POST -H "Authorization: Bearer <Token Omitted>" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 797d8be2-a14b-5b25-a620-25540a264de6" -d '{ "contactKey": "local-123456", "attributeSets": [{ "name": "Email Addresses", "items": [{ "values": [{ "name": "Email Address", "value": "[email protected]" },{ "name": "HTML Enabled", "value": true }] }] } ] }' "https://www.exacttargetapis.com/contacts/v1/contacts"
Response
{
"operationStatus": "FAIL",
"rowsAffected": 0,
"requestServiceMessageID": "cebddc10-69ab-4399-92b8-ced05df00a1b",
"hasErrors": true,
"resultMessages": [
{
"formatStringParams": [
"ValueDefinition",
null,
null,
"HTML Enabled"
],
"messageFormatString": "Unable to resolve schema element of type: {0} by reference. [Id: {1}, Key: {2}, Name: {3}]",
"resultType": "Validation",
"resultClass": "Error",
"resultCode": "SchemaObjectNotFoundByReference",
"message": "Unable to resolve schema element of type: ValueDefinition by reference. [Id: , Key: , Name: HTML Enabled]"
}
],
"serviceMessageID": "075ac816-e226-4698-a969-e082efdcf5c0"
}