You need to sign in to do that
Don't have an account?
Create AccountContactRelations with REST-API
Hello,
I have implemented an integration through the REST-API and I'm able to “get”, “create” and “update” Account and Contact through the REST API.
The only thing I don’t know how to handle is the AccountContactRelations object. I think the “get” should work correctly using for example an URL “sobjects/Account/0012X000021VVYVQA4/AccountContactRelations/” and I think my implementation is working correctly.
But I don’t know how to create one through the REST-API.
Is chapter in the developer documentation https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_relationships.htm (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_relationships.htm" style="color:#0563c1; text-decoration:underline" target="_blank" title="https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_relationships.htm) for this kind of object?
Best Regards
Bernhard Maehr
/services/data/v48.0/sobjects/AccountContactRelation
Request body :
---------------------------------------------------------------
{
"AccountId" : "your_acc_id" ,
"Contactid" : "your_con_id"
}
-------------------------------------
All Answers
Can you try GET with something like /services/data/v39.0/sobjects/AccountContactRelation/SourceId__c/ABCD
{"Account":{"SourceId__c":"AB"},"Contact":{"SourceId__c":"XY"}}
Let me know if this works.Thanks
Hello Swetha,
I'm not sure if I understand you right but I was not able to make it work.
First thing: Is really GET used to create the relation?
Is SourceId__c a constant value or do I need to replace it for example with the id of the Account?
And what is ABCD?
As far as I understood your post {"Account":{"SourceId__c":"AB"},"Contact":{"SourceId__c":"XY"}} is the answer of the GET request.
If I try /services/data/v39.0/sobjects/AccountContactRelation/ or /services/data/v39.0/sobjects/AccountContactRelations/ in workbench I get "Service not found"
/services/data/v48.0/sobjects/AccountContactRelation
Request body :
---------------------------------------------------------------
{
"AccountId" : "your_acc_id" ,
"Contactid" : "your_con_id"
}
-------------------------------------
@Gaurav:
Service not found at: /services/data/v48.0/sobjects/AccountContactRelation
GO TO SETUP -> ACCOUNT SETTINGS -> CHECK IF THIS SETTING IS CHECKED.