Variables API
A CRM Variable can have unique set of values and can be widely used as merge fields in Email templates, Mail merge templates, and Inventory templates. You can also use them as reusable authentication parameters in APIs.
Get Variables Data
Purpose
To retrieve all the available variables through an API request.
Request Details
Request URL
{api-domain}/crm/{version}/settings/variables
To get specific variable:
{api-domain}/crm/{version}/settings/variables/{variable_id}?group={variable_group_id}
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.settings.variables.{operation_type}
Possible operation types
ALL - Full access to variable data
READ - Get variable data
Parameters
- groupstring, mandatory
Specify the unique ID/API name of the group to which the variable belongs.
Note
- Group ID/group API name is mandatory in case of fetching specific variable data. The system throws an error, otherwise.
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v6/settings/variables"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copiedresponse = invokeurl
[
url: "https://www.zohoapis.com/crm/v6/settings/variables"
type: GET
connection:"crm_oauth_connection"
];
info response;
Response JSON keys
- api_namestring
Represents the API name of the CRM variable.
- namestring
Represents the display name of the variable.
- descriptionstring
Represents the description of the variable, if any.
- idstring
Represents the unique ID of the variable.
- typestring
Represents the type of the variable. It can be: text, integer, percent, decimal, currency, date, datetime, email, phone, url, textarea, checkbox, long.
- variable_groupJSON object
Represents the API name and ID of the variable group to which the current variable belongs to.
- valuestring
Represents the value of the variable, if any.
Possible Errors
- INVALID_URL_PATTERNHTTP 404
Please check if the URL trying to access is a correct one
Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above. - OAUTH_SCOPE_MISMATCHHTTP 401
Unauthorized
Resolution: Client does not have ZohoCRM.settings.variables.READ scope. Create a new client with valid scope. Refer to scope section above. - NO_PERMISSIONHTTP 403
Permission denied to read
Resolution: The user does not have permission to read variables data. 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 read variables data
Resolution: The user does not have the permission to retrieve variables data. Contact your system administrator.
Sample Response
Copied{
"variables": [
{
"api_name": "sample1",
"name": "SV1",
"description": "This is a sample variable.",
"id": "4150868000002146001",
"type": "text",
"variable_group": {
"api_name": "General",
"id": "4150868000000597005"
},
"value": ""
},
{
"api_name": "sample2",
"name": "SV2",
"description": null,
"id": "4150868000002517007",
"type": "long",
"variable_group": {
"api_name": "General",
"id": "4150868000000597005"
},
"value": ""
},
{
"api_name": "sample3",
"name": "SV3",
"description": null,
"id": "4150868000002517005",
"type": "textarea",
"variable_group": {
"api_name": "General",
"id": "4150868000000597005"
},
"value": ""
},
{
"api_name": "Sample4",
"name": "SV4",
"description": null,
"id": "4150868000002517003",
"type": "datetime",
"variable_group": {
"api_name": "General",
"id": "4150868000000597005"
},
"value": ""
}
]
}