Get Territories of a Record
Purpose
To get the details of the territories assigned to a record.
Endpoints
Request Details
Request URL
{api-domain}/crm/v2.1/{module_api_name}/{record_id}
Supported modules
Leads, Accounts, Contacts, and Deals
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.modules.ALL
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
Possible module names
leads, accounts, contacts, and deals
Possible operation types
ALL - Full access to the record
READ - Read records in the module
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v2.1/Deals/554023000000497035"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-X GET
Copied//Get instance of TerritoriesOperations Class
$territoriesOperations = new TerritoriesOperations();
//Call getRelatedLists method
$response = $territoriesOperations->getTerritory($territoryId);
Copied# Get instance of TerritoriesOperations Class
to = Territories::TerritoriesOperations.new
# Call get_territory method that takes territory_id as parameter
response = to.get_territory(territory_id)
Response JSON Keys
- Namestring
Represents the name of the territory.
- idstring
Represents the unique ID of the territory.
- $assigned_byJSON object
Represents the name and ID of the user who assigned the territory to the record.
- $assigned_timestring
Represents the date and time at which the territory was assigned to the record.
- $assignedstring
Represents the how the territory was assigned to the record. The possible values are:
- manually: the user has assigned the territory through the API or the UI, manually.
- automatically: the system has assigned the territories.
Possible Errors
- OAUTH_SCOPE_MISMATCHHTTP 401
invalid oauth scope to access this URL
Resolution: Client does not have ZohoCRM.modules.{module_name}.READ scope. Create a new client with valid scope. Refer to scope section above. - NO_PERMISSIONHTTP 403
Permission denied to read records
Resolution: The user does not have permission to read records. Contact your system administrator. - INTERNAL_ERRORHTTP 500
Internal Server Error
Resolution: Unexpected and unhandled exception in Server. Contact support team. - INVALID_REQUEST_METHODHTTP 400
The http request method type is not a valid one
Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above. - AUTHORIZATION_FAILEDHTTP 400
User does not have sufficient privilege to update records
Resolution: The user does not have the permission to update records. Contact your system administrator.
Sample Response
Copied{
"data": [
{
"Owner": {
"name": "Patricia Boyle",
"id": "111111000000043376",
"email": "p.boyle@abc.com"
},
"Territories": [
{
"Name": "Texas",
"id": "111111000000046898",
"$assigned_by": null,
"$assigned_time": "2020-03-05T16:07:28+05:30",
"$assigned": "automatically"
},
{
"Name": "South",
"id": "111111000000046458",
"$assigned_by": {
"name": "Patricia Boyle",
"id": "111111000000043376"
},
"$assigned_time": "2020-03-05T16:07:28+05:30",
"$assigned": "manually"
}
]
}
]
}