Territories of a User
Purpose
To get the territories related to a user.
Endpoints
- GET /users/{user_id}/territories
- GET /users/{user_id}/territories/{territory_id}
Request Details
Request URL
To get all the territories of the user - {api-domain}/crm/{version}/users/{id}/territories
To get a specific territory of the user - {api-domain}/crm/{version}/users/{id}/territories/{territory_id}
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.users.{operation_type}
(or)
scope=ZohoCRM.settings.territories.{operation_type}
Possible operation types
ALL - Full access to the record
READ - Get records from the module
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/users/3652397000000186017/territories"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-X GETCopiedresponse = invokeurl
[
	url: "https://www.zohoapis.com/crm/v8/users/3652397000000186017/territories"
	type: GET
	connection:"crm_oauth_connection"
];
info response;Response JSON Keys
Response JSON Keys in the "info" object (only while fetching all the territories related to the user)
- idstringRepresents the unique ID of the territory that the user is associated to. 
- ManagerJSON objectRepresents the name and ID of the manager of the territory. 
- NamestringRepresents the name of the territory. 
- Reporting_ToJSON objectRepresents the name and ID of the parent territory. For the parent territory, this value is null. 
- per_pageintegerRepresents the number of records you can fetch in a single API call. The maximum value is 200. 
- countintegerRepresents the number of records fetched in this API call. 
- pageintegerRepresents the page number from which the records were fetched. The default value us 1. 
- more_recordsbooleanRepresents whether or not there are more records in the module to be fetched. 
Possible Errors
- INVALID_DATAHTTP 400You have specified an invalid ID for either the user, territory or both. 
 Resolution: The resource_path_index in the response gives you the position of the invalid ID in the request. Specify a valid ID.
Sample Response
Copied{
    "territories": [
        {
            "id": "3652397000000715341",
            "Manager": {
                "name": "Patricia Boyle",
                "id": "3652397000000186017"
            },
            "Name": "USA",
            "Reporting_To": null
        },
        {
            "id": "3652397000007612003",
            "Manager": {
                "name": "Jane Smith",
                "id": "3652397000000281001"
            },
            "Name": "Texas",
            "Reporting_To": {
                "id": "3652397000000715341",
                "Name": "USA"
            }
        },
        {
            "id": "3652397000007612015",
            "Manager": {
                "name": "Jane Smith",
                "id": "3652397000000281001"
            },
            "Name": "Washington",
            "Reporting_To": {
                "id": "3652397000000715341",
                "Name": "USA"
            }
        },
        {
            "id": "3652397000007622003",
            "Manager": {
                "name": "Patricia Boyle",
                "id": "3652397000000186017"
            },
            "Name": "New York",
            "Reporting_To": {
                "id": "3652397000000715341",
                "Name": "USA"
            }
        }
    ],
    "info": {
        "per_page": 200,
        "count": 4,
        "page": 1,
        "more_records": false
    }
}