Page 1 of 2
Link contact to company customer
Posted: Fri Jan 20, 2023 11:12 am
by Ashishs
Hi,
When I push contact using the API, I would like to link that contact to a company customer. How do I do it?
Regards,
Ash
Re: Link contact to company customer
Posted: Sun Jan 22, 2023 11:30 pm
by Sindre
Hi Ashish,
To link an existing contact to a customer, either individual or company use this endpoint:
Code: Select all
/api/v1.0/companies/{companyID}/customers/{customerID}/contacts/
Here you can use POST to sendt the id of the new contact you with to connect with the customer:
See more info:
https://developer.simprogroup.com/apido ... r-Contacts
The same endpoint can be used to create a new contact directly on the customer.
Regards
Re: Link contact to company customer
Posted: Tue Jan 24, 2023 10:02 am
by Ashishs
Thanks Sindre for the reply.
So, if I have to link an existing contact to a customer, I send a POST request to
Code: Select all
/api/v1.0/companies/{companyID}/customers/{customerID}/contacts/
However, this POST request can only have "Contact" property in the request body, else I will get "422 Unprocessable" error.
Is there a way to unlink a contact from the customer using the API? If I send a POST request for a different customer using same Contact id, it just links the new customer with the contact without unlinking the old customer. Is there a PATCH way of doing it?
Re: Link contact to company customer
Posted: Tue Jan 24, 2023 11:50 pm
by Sindre
Hi,
To unlink an existing contact from a customer you can use the DELETE endpoint when you've chosen the contact on the customer you wish to remove.
Code: Select all
/api/v1.0/companies/{companyID}/customers/{customerID}/contacts/{contactID}
https://developer.simprogroup.com/apido ... dd62b14684
Regards
Re: Link contact to company customer
Posted: Wed Mar 08, 2023 7:12 pm
by jimhalverson
Any chance of seeing an example of the body used to assign an existing contact? I got the delete to work but post returns "No data to be inserted for customer contact." I don't seem to be able to find the correct URL and body to make it work.
Re: Link contact to company customer
Posted: Wed Mar 08, 2023 10:40 pm
by Sindre
Hi,
To add an existing contact to a customer use this endpoint to make a POST request:
Code: Select all
/api/v1.0/companies/{companyID}/customers/{customerID}/contacts/
The body will look like this:
To get a list of existing contacts you can use this endpoint:
Code: Select all
/api/v1.0/companies/{companyID}/customers/{customerID}/contacts/
Here is the documentation for the POST request:
https://developer.simprogroup.com/apido ... 269e8392a6
I hope this helps.
Regards
Re: Link contact to company customer
Posted: Wed Mar 06, 2024 4:43 am
by aijuy
Hi Sindre,
We are having the same question about how to use api to link existing contact with an customer.
And I tried to make a POST request with the endpoint you mentioned as per below:
Code: Select all
/api/v1.0/companies/{companyID}/customers/{customerID}/contacts/
And request body we use known contact id (233) as per below:
However we are getting error message
Code: Select all
{'path': '/Customer', 'message': 'Must be an integer', 'value': '233'}
Kindly ask how should we fix this one?
Re: Link contact to company customer
Posted: Wed Mar 06, 2024 5:10 am
by AidenTew
Hi aijuy,
try without the "" on ur body request.
eg.
Re: Link contact to company customer
Posted: Wed Mar 06, 2024 6:18 am
by aijuy
Hi Aiden, thanks for the prompt reply!
I've tried to change body request to
But still got the error below:
Code: Select all
{"errors":[{"path":"/Contact","message":"Must be an integer","value":"233"}]}
Could you please advice further? Cheers!
Re: Link contact to company customer
Posted: Thu Mar 07, 2024 5:14 am
by AidenTew
Hi aijuy,
From the error you're getting it seems like you're still passing the value as a string when it is expecting an integer,
Can you try posting through Postman and ensure the body type is JSON?