Get Variables API
Overview
The Get Variables API endpoint retrieves variables and their values for the current user or device.
Endpoint
Here is a base sample endpoint from the account in the India region:
https://in1.api.clevertap.com/1/getVars
Authentication
Authentication is required using accountId and passcode headers.
Headers
Refer to Headers for more details.
Region
Refer to Regions to view region-specific sample endpoints
HTTP Method
The HTTP method is GET for the GET Variables API
Body Parameters
Parameter | Description | Type | Example | Required/Optional |
---|---|---|---|---|
identity | Uniquely identifies the user. It can be the userβs email, phone number, or any other identifier you use to tag your users. | String | ("[email protected]" / Martin ) | Required (If identity is provided, guid becomes optional) |
`guid | Uniquely identifies the user with CleverTap Global Object ID. | String | β34322425" | Optional (If guid is provided, identity becomes optional) |
includeDefaults | Determines whether the response should include default values for variables that do not have set override values. | Boolean | false (default) | Optional |
Note
If the profile or GUID does not exist, the API returns the default values for all defined variables. It does not create new profiles.
Sample Request
curl -X GET -d '{"identity":"[email protected]","objectId":"34322425","includeDefaults":false}' "https://in1.api.clevertap.com/1/getVars" \
-H "X-CleverTap-Account-Id: ACCOUNT_ID" \
-H "X-CleverTap-Passcode: PASSCODE" \
-H "Content-Type: application/json; charset=utf-8"
Sample Response
{
"variables": {
"zFolderA.aVariable": 9.9,
"zFolderA.AVariable": 10.0,
"variableB": 9.9,
"zFolderB.dummy": 10.1,
"zFolderA.zFolder.dummy": 25.0,
"variableA": 10.0},
"status": "success"
}
Errors
The Get Variables API may return the following errors:
Error Name | Reason |
---|---|
Profile not found | The user profile could not be located. |
Profile lookup is not available at the moment | Access to user profile lookup is currently unavailable. |
Blacklisted device | The device is blacklisted. |
Given identity is not in device profile identities | The provided identity does not match any identities associated with the device. |
Something happened. Contact the support. | An unexpected error. Contact support for assistance. |
Updated 8 months ago