Updating the details of a Voyado Engage contact is done through the /contacts endpoint using their unique contactId and the PATCH method:
PATCH /api/v3/contacts/{contactId}
If you don’t have the contactId, you can get it using other contact attributes.
This PATCH endpoint is to be used for single contact updates. Do NOT use it for bulk updates of contacts. In that case, use the bulk methods provided.
When you have the contactId you call the endpoint like this:
PATCH /api/v3/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 be updated.
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, "", etc.) will overwrite the current values on the contact.
You can’t use this endpoint to update a contact’s contact type. This has to be done using the /contacts/[contactId]/updateContactType endpoint. See the next section.
To update contactType to “Member” or to another value, you will use this endpoint:
POST /api/v3/contacts/{contactId}/updateContactType?contactTypeId=Member
In this example we are changing the contact’s type to “Member”.
This is the only way to update a contact’s contactType. If you try to use the PATCH method shown above to change contactType it will not work.
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. This means it is 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.
If the request has failed, you’ll get one of the following HTTP error codes:
- 400 : NoData
- 404: Not Found