Link contact to company customer

Posts about the simPRO API. Help/support/how-to etc.
Forum rules
  • Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
  • No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
  • Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
  • Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
  • Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
  • Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
  • Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
  • Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
Ashishs
Posts: 68
Joined: Tue Apr 16, 2019 11:14 pm

Link contact to company customer

Post by Ashishs » Fri Jan 20, 2023 11:12 am

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
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: Link contact to company customer

Post by Sindre » Sun Jan 22, 2023 11:30 pm

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:

Code: Select all

"Contact": 0,
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
Sindre
API Developer | Simpro Software Group
Ashishs
Posts: 68
Joined: Tue Apr 16, 2019 11:14 pm

Re: Link contact to company customer

Post by Ashishs » Tue Jan 24, 2023 10:02 am

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?
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: Link contact to company customer

Post by Sindre » Tue Jan 24, 2023 11:50 pm

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
Sindre
API Developer | Simpro Software Group
jimhalverson
Posts: 1
Joined: Wed Mar 08, 2023 6:32 pm

Re: Link contact to company customer

Post by jimhalverson » Wed Mar 08, 2023 7:12 pm

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.
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: Link contact to company customer

Post by Sindre » Wed Mar 08, 2023 10:40 pm

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:

Code: Select all

{
    "Contact": {contactID}
}
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
Sindre
API Developer | Simpro Software Group
aijuy
Posts: 6
Joined: Wed Mar 06, 2024 4:32 am

Re: Link contact to company customer

Post by aijuy » Wed Mar 06, 2024 4:43 am

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:

Code: Select all

{
    "Contact": "233"
}
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?
AidenTew
Posts: 25
Joined: Fri Mar 01, 2024 4:15 am

Re: Link contact to company customer

Post by AidenTew » Wed Mar 06, 2024 5:10 am

Hi aijuy,

try without the "" on ur body request.

eg.

Code: Select all

{
    "Contact": 233
}
Aiden
API Developer | Simpro Software Group
aijuy
Posts: 6
Joined: Wed Mar 06, 2024 4:32 am

Re: Link contact to company customer

Post by aijuy » Wed Mar 06, 2024 6:18 am

Hi Aiden, thanks for the prompt reply!
I've tried to change body request to

Code: Select all

{"Contact":233}
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!
AidenTew
Posts: 25
Joined: Fri Mar 01, 2024 4:15 am

Re: Link contact to company customer

Post by AidenTew » Thu Mar 07, 2024 5:14 am

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?
Aiden
API Developer | Simpro Software Group
Post Reply