Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Find a Developer >

How to update contact name?

Started by Kris Gella -   in Find a Developer

from Xero website they say we can update Contact Name via API.
i have tried to pass ContactID, ContactNumber and new Name value.

<Contacts>
<Contact>
<ContactID>d2d3a415-6ebe-4d66-8d39-xxxxxxxxxxxxx</ContactID>
<ContactNumber>1</ContactNumber>
<Name>New Name1</Name>
</Contact>
<Contact>
<ContactID>163b97ee-30f5-4408-a186-xxxxxxxxxxxx</ContactID>
<ContactNumber>2</ContactNumber>
<Name>New Name2</Name>
</Contact>
</Contacts>

Message: "Another contact has this contact number. Please enter a different contact number."

pls halp!
@Chris - The ContactID, Name and ContactNumber are all unique identifiers. You can read more about this in the API Reference.

So the reason you're getting this message is one of your other contacts will be using one of these ContactNumbers already.
 

Tony Rule (Xero Staff)  

I get the same issue. The reason is not other contacts using this number, but the same contact having this number. Because the Api adds a new contact instead of updating the "Name" field of the same contact (If the ContactNumber is removed from the above query).

Is it not allowed to update the Contact "Name" field through API?

(Tried on the API Previewer as well as using sdk Contacts.UpdateAsync)
 

Iresha Jayasekara