I'm trying to find some documentation on how to do this. I will start trying to use this endpoint now, but its not clear to me if it will work:
<module>/:record/link/:link_name/:remote_id POST
But I do not know if it will work.
Thanks for some help.
I'm trying to find some documentation on how to do this. I will start trying to use this endpoint now, but its not clear to me if it will work:
But I do not know if it will work.
Thanks for some help.
Good morning Marc.
You are on the right track, that is the API to link two records.
If you look at the Opportunities Vardefs in your cache folder:
cache/modules/Opportunities/Opportunityvardefs.php
and search for "Contacts" you will find the definition of the link, there you will see that the link name is "contacts" (not to be confused with the relationship name which is "opportunities_contacts")
So, once you have identified the link name, the opportunity id, and the contact id, you can easily link the two with that API.
say your
opportunity id = 60f2b566-30b5-11ea-8ef6-001a4a160206
contact id = ec740bd4-fbca-11e7-8ee2-001a4a160206
Your API call to link Contact to Opportunity:
Opportunities/60f2b566-30b5-11ea-8ef6-001a4a160206/link/contacts/ec740bd4-fbca-11e7-8ee2-001a4a160206
You could do the same starting from the Contacts module, look up the link name for Opportunities in the Contacts cache file:
cache/modules/Contacts/Contactvardefs.php
Identify the name of the link which is "opportunities"
And build the API call from the Contacts:
opportunity id = 60f2b566-30b5-11ea-8ef6-001a4a160206
contact id = ec740bd4-fbca-11e7-8ee2-001a4a160206
Your API call to link the Opportunity to the Contact:
Contacts/ec740bd4-fbca-11e7-8ee2-001a4a160206/link/opportunities/60f2b566-30b5-11ea-8ef6-001a4a160206
Hope this helps clarify that Rest API.
FrancescaS
I think your end points are missing the "link/" part. Mark has this in his original post - just a small typo in your answer. At least your answer is on-topic - with the question specifically asking for help on how to use the API to do this
I believe it should be (based on your examples):
Contacts/ec740bd4-fbca-11e7-8ee2-001a4a160206/link/opportunities/60f2b566-30b5-11ea-8ef6-001a4a160206
That should link an existing Opportunity to the Contact record selected.
Thanks,
JH.
I think your end points are missing the "link/" part. Mark has this in his original post - just a small typo in your answer. At least your answer is on-topic - with the question specifically asking for help on how to use the API to do this
I believe it should be (based on your examples):
Contacts/ec740bd4-fbca-11e7-8ee2-001a4a160206/link/opportunities/60f2b566-30b5-11ea-8ef6-001a4a160206
That should link an existing Opportunity to the Contact record selected.
Thanks,
JH.
Yes, this is the way!
Thanks.
Good catch! Thank you John Hawkins! I updated my post. :)