Whenever I try to update a Xero contact that already exists in the system using a POST
request I get the following error
"ValidationErrors":
[{
"Message": "The contact name Test Contact is already assigned to another contact.
The contact name must be unique across all active contacts."
}]
However this is directly from their documentation. They say that you will get an error if you use PUT to push an update, and with POST it is supposed to work successfully. What am I doing wrong?
POST Contacts Use this method to create or update one or more contact records
When you are updating a contact you don’t need to specify every element. If you exclude an element then the existing value will be preserved
PUT Contacts Use this method to create one or more contact records. This method works very similar to POST Contacts but if an existing contact matches your ContactName or ContactNumber then you will receive an error.
My Code making request
//req options
let options =
{
method: 'POST',
headers:
{
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token,
'xero-tenant-id': tenant_id,
'Accept': 'application/json'
},
data: { "Contacts": contacts }
}
//send request
let res = await axios(url, options)