Update Related Records Using External ID
Purpose
To update the related list records using external IDs.
Endpoints
- PUT /{module_API_name}/{external_field_API_name/value}/{related_list_API_name}
Request Details
Request URL
{api-domain}/crm/{version}/{module_API_name}/{external_field_API_name/value}/{related_list_API_name}
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
X-EXTERNAL: {module_API_name}.{external_field_API_name}
Scope
ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
Possible module names
leads, deals, contacts, accounts, products, campaigns, appointments, services, and pricebooks
Possible operation types
ALL - Full access to the related records
WRITE - Edit related records
UPDATE - Update related records in the module
Associating a Contact and a Deal using their external IDs
- In this example, extcontact3 and extdeal3 are the values of the external fields External_Contact_ID and External_Deal_ID in the Contacts and Deals modules, respectively. We will reference these values to associate the contact with the deal. 
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/Contacts/extcontact3/Deals"
-X PUT
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-H "X-EXTERNAL: Contacts.External_Contact_ID,Deals.External_Deal_ID"
-d "@sample.json"Sample Input
Copied{
    "data": [
        {
            "External_Deal_ID": "extdeal3",
            "Contact_Role": "111111000000026002"
        }
    ]
}Sample Response
Copied{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "External_Deal_ID": "extdeal3",
                "id": "111111000000094028"
            },
            "message": "relation added",
            "status": "success"
        }
    ]
}Possible Errors
- INVALID_DATAHTTP 400The ID of the external field is invalid. 
 Resolution: Specify the correct external ID.
- INVALID_DATAHTTP 400You have specified an invalid external ID for the base module. 
 Resolution: Specify the correct external ID.
- MANDATORY_NOT_FOUNDHTTP 400You have specified the external ID in the header for the related module but not in the request body. 
 Resolution: It is mandatory to include the external field in the request body when you specify in the header.
- INVALID_REQUEST_METHODHTTP 400The request method is incorrect. 
 Resolution: Use the HTTP GET method to make this API call. Any other request method will result in this error.
- AUTHORIZATION_FAILEDHTTP 400You do not have sufficient permission to get the related records. 
 Resolution: Contact your system administrator.
- OAUTH_SCOPE_MISMATCHHTTP 401The access token you have used to make this API call does not have the required scope. 
 Resolution: Generate a new access token with the scope mentioned in the Scope section.
- NO_PERMISSIONHTTP 403You do not have permission to get related records' data. 
 Resolution: Contact your system administrator.
- INVALID_URL_PATTERNHTTP 404The request URL is incorrect. 
 Resolution: Specify a valid request URL. Refer to the Request URL section for the right URL.
- INTERNAL_ERRORHTTP 500Unexpected and unhandled exception in the server. 
 Resolution: Contact the support team at support@zohocrm.com.
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/Contacts/111111000000085009/Deals"
-X PUT
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-H "X-EXTERNAL: Deals.External_Deal_ID"
-d "@sample.json"Sample Input
Copied{
    "data": [
        {
            "Contact_Role": "111111000000026002",
            "External_Deal_ID": "extdeal3"
        }
    ]
}Sample Response
Copied{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "External_Deal_ID": "extdeal3",
                "id": "111111000000094028"
            },
            "message": "relation added",
            "status": "success"
        }
    ]
}