Hi everyone,
I really hope some can help me with updating an existing contact and client.
I am trying to pass Salesforce record id’s into the custom fields on contacts, but iterating over the ‘Update a client’ option in Integromat doesn’t seem to be possible. Passing in a contact id doesn’t seem to update an existing record, and instead overrides/creates a new one.
I’ve since tried to make an API post request using the client id but that only seems to create a new client with blank information. I’ve included some of the commands I’ve tried below along with the result and expected outcome.
Data (truncated):
{
"data": {
"id": 1,
"name": "Test & Test2 Thornton",
"display_name": "Test & Test2 Thornton",
"address1": "1215 Water Fall Way",
"id_number": "",
"custom_value1": "",
"contacts": [
{ "id": 2,
"first_name": "Contact1",
"last_name": "Thornton",
"email": "jihan@fillnoo.com",
"phone": "5555555555",
"custom_value1": ""
},
{ "id": 3,
"first_name": "Contact2",
"last_name": "Thornton",
"email": "jihan.thornton@fillnoo.com",
"phone": "3333333333",
"custom_value1": ""}
] }
}
Attempt 1: Access Client directly
curl --location -g --request POST '${host}/api/v1/clients/1' \
--header 'Content-Type: application/json' \
--header 'X-Ninja-Token: TOKEN' \
--header 'X-Requested-With: XMLHttpRequest' \
--data-raw '{"contacts": [{"id": 2,"custom_value1": "newid"}]}'
- Expected: For custom_value1 of Contact1 to change to “newid”
- Postman Result: Returns unchanged client
- Terminal Result: Symfony throws “MethodNotAllowedHttpException”
Attempt 2: Changed url and attempted to filter using client_id
curl --location -g --request POST '${host}/api/v1/clients' \
--header 'Content-Type: application/json' \
--header 'X-Ninja-Token: TOKEN' \
--header 'X-Requested-With: XMLHttpRequest' \
--data-raw '{"client_id": "1","contacts": [{"id": 2,"custom_value1": "newid"}]}'
- Expected: For custom_value1 of Contact1 to change to “newid”
- Postman Result: Returns unchanged clients
- Terminal Result: Creates new blank contact and client
Attempt 3: Changed url and attempted to change contact directly using id
curl --location -g --request POST '${host}/api/v1/contacts/2' \
--header 'Content-Type: application/json' \
--header 'X-Ninja-Token: TOKEN' \
--header 'X-Requested-With: XMLHttpRequest' \
--data-raw '{"id": 2,"custom_value1": "newid"}'
- Expected: For custom_value1 of Contact1 to change to “newid”
- Postman Result: Returns unchanged clients
- Terminal Result: Symfony throws “MethodNotAllowedHttpException”
I’m really hoping this is a typo or missing header situation; in case it isn’t though I’d really appreciate either guidance on how to accomplish updating an existing client without overriding it or debugging this.
Thanks in advance