Updating a phone number of an existing person merely appends it to the list

20 views
Skip to first unread message

christian dawson

unread,
Oct 15, 2018, 11:56:38 AM10/15/18
to Capsule API
Using a PUT request to updated an existing person only appends the updated number to the list.

If we started with:

111.222.3333 Work

and I went in and updated my number to be 111.222.3334, then after my update request (which updates other values just fine)

111.222.3333 Work
111.222.3334 Work

I've sent arrays with just 1 phone object in them just to try and wipe anything out - no dice.
What gives??

Daniel Ireson

unread,
Oct 15, 2018, 12:30:18 PM10/15/18
to Capsule API
Hi Chris,

Good question, I can understand how you would expect it to behave in that way.

Our API works slightly differently in that you have to pass the phone number ID as well as a "_deleted" JSON property set to true. The phone number ID can be found in the response of a GET request to the party endpoint.

For example, to delete a number with ID 23406 and add a new number 123456789 your request body would look like:

{
  "party": {
    "phoneNumbers": [
      {
        "id": 24306,
        "_delete": true
      },
      {
    "number": "123456789"
      }
    ]
  }
}


Update operations for addresses, websites, email addresses, tags and fields also work in the same way

Does that make sense? Let me know if you run into any problems or require further clarification.

Cheers,
Daniel
Reply all
Reply to author
Forward
0 new messages