Update contact
Updating the details of a Voyado Engage contact is done through the /contacts endpoint using their contactId:
PATCH /api/v3/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:
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.
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.
Caution
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.
Changing contact type for a contact
To update contactType to "Member" or to any other contact type, 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".
Important
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. 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