Update contact
Updating the details of a Voyado Engage contact is done through the /contacts endpoint using their contactId:
POST /api/v2/contacts/{contactId}
If you don’t have the contactId, you can get it using other contact attributes.
When you have the contactId you call the endpoint like this:
POST /api/v2/contacts/430d3329-7eef-45c0-37f9-ae9300a0daceid
As the payload, send ONLY the attributes that you want to change:
{ "lastName": "Examplesson", "street": "New Street 1337" }
In this example, the contact has changed their surname and moved to a new address. These attributes will now be updated.
Warning
When updating contacts over the API be sure to ONLY send the fields you want to update and nothing else. This applies for individual as well as bulk updates. Any empty fields added to your update payload (string.Empty, null, "" or whatever) will overwrite the current values on the contact. If you do not want to change a field, then do not add it to the update call.
Changing contact type for a contact
To update contactType to Member (also known as promoting to member) you have to use this endpoint:
POST /api/v2/contacts/{contactId}/promoteToMember
For changing to any other contactType you will need to use a different endpoint:
POST /api/v2/contacts/{contactId}/updateContactType?contactTypeId=MyType
Note that if you try to update to Member using this endpoint, it will not work. In that case, you will have to use the first option.
Caution
Promote a contact to Member only with the /promoteToMember endpoint.
Don't send empty values
You need to be careful to never send empty values in the JSON payload when updating a contact. If a field exists in the payload, Engage will use that value and overwrite the existing one. For example, if a contact's last name isn’t added in the POS, do not add that field to the payload.
// DO NOT DO THIS! { "firstName": "Example", "lastName": "", "street": "Big Street 1234" }
In this case, the current value of lastName will be overwritten by an empty string. You probably don't want this.
Instead, do this:
// This is how to do it { "firstName": "Example", "street": "Big Street 1234" }
Note also that a field which does not exist in the contact's data will be ignored and no error will be returned. So it's important to make sure you are sending the right name for each field.
// This update will be ignored { "firstNam": "Example", }
Responses
A successful update will return HTTP 200 Ok along with the contact's new data set as the response body.
If the request has not been successful, you'll get one of the following HTTP error codes:
400 : NoData
404: Not Found