iQ Variables API
iQ Variables API uses a PATCH method to update profile variables.
To learn more about this API and available object fields, see iQ Profiles API and iQ Profiles Objects.
How it works
Use the PATCH
method to create, update, and delete variables in the iQ Profile object.
PATCH /v3/tiq/accounts/{ACCOUNT}/profiles/{PROFILE}
When you use the PATCH method you are making changes to your profile variables programmatically using a save or save-as. After making changes with the API you must still log into the application to publish.
Example cURL request
curl --location --request PATCH 'https://platform.tealiumapis.com/v3/tiq/accounts/{account}/profiles/{profile}' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUx...MiJ9' \
--header 'Content-Type: application/json' \
--data '
Authentication
The bearer token is used to authenticate all API calls and not the API key. The API key is only used in the authentication call. In addition to the bearer token, the authentication response includes a region-specific hostname that must be used in subsequent server-side API calls.
To learn about generating a bearer token from the API key, see Authentication.
Profile fields
Profile variables are JSON objects that contain the following possible fields:
Field | Type | Required | Description |
---|---|---|---|
versionTitle |
String | Optional | The title of the resulting saved version. Default with saveType set to saveAs : API | {TIMESTAMP} Default with saveType set to save : Existing version title |
saveType |
String | Optional | The type of save to perform with the PATCH request: save or saveAs . Default is saveAs . |
notes |
String | Required | Additional notes about the publish version. |
operationList |
Array | Required | A list of operation objects. For example, multiple variables. |
op |
String | Required | The operation to perform: add , replace , or remove . |
path |
String | Required | The component type and ID to update, in the format:/variables . |
value.object |
String | Required | The object type being updated: variable or extension . |
value.name |
String | Required (for add/replace) | The variable title. |
value.alias |
String | Required | The variable name. |
value.type |
String | Required | A prefix representing the variable type.ls - Local storage ss - Session storage udo - Universal Data Objectqp - Query string parametercp - Cookiejs - JavaScript variablemeta - Meta data elementva - AudienceStream attribute (Read only. This type can be used in other iQ Profile API elements but cannot be created using the API.) |
value.notes |
String | Optional | Notes about the variable. |
Example request
{
"versionTitle":"Version 2022.03.22.2108",
"saveType": "saveAs",
"notes": "version notes here",
"operationList":[
{
"op":"add",
"path":"/variables",
"value":{
"object": "variable",
"name": "viewport_height",
"alias": "Viewport Height",
"type": "dom",
"notes":"dom variable"
}
}
]
}
PATCH operation parameters
Instead of POST
, PUT
, and DELETE
methods, the PATCH
method uses the op
parameter to specify the action to perform.
The op
parameter supports the following values:
add
- Create the component.replace
- Update the component.remove
- Delete the component.
To specify the the type and ID of the component, use the path
parameter. The path
parameter format is /{TYPE}/{ID}
.
For example, to add a variable use:
"op" : "add",
"path" : "/variables"
To update a specific variable, add the ID to the path:
"op" : "replace",
"path" : "/variables/503"
Create variable
This PATCH method takes a profile variable object and additional variable fields.
Example request
{
"versionTitle":"Version 2022.03.22.2108",
"saveType": "saveAs",
"notes": "version notes here",
"operationList":[
{
"op":"add",
"path":"/variables",
"value":{
"object": "variable",
"name": "viewport_height",
"alias": "Viewport Height",
"type": "dom",
"notes":"dom variable"
}
}
]
}
Update variable
This PATCH method takes a profile variable object and additional variable fields.
Example request
{
"versionTitle":"Version 2022.03.22.2108",
"saveType": "saveAs",
"notes": "version notes here",
"operationList":[
{
"op":"replace",
"path":"/variables/503",
"value":{
"object": "variable",
"name": "viewport_height",
"alias": "Viewport Height",
"type": "dom",
"notes":"dom variable"
}
}
]
}
Delete variable
This PATCH method takes a profile variable object and additional variable fields.
Example request
{
"versionTitle":"Version 2022.03.22.2108",
"saveType": "saveAs",
"notes": "version notes here",
"operationList":[
{
"op":"remove",
"path":"/variables/503",
"value":{
"object": "variable"
}
}
]
}
Error messages
Potential error messages for this endpoint:
Error Code | Error Message |
---|---|
400 | "Profile libraries are out of date, merge changes before patching profile - {ACCOUNT} | profile: {PROFILE}" "Variable validation failed - variableId: {VARIABLE_ID} | {ACCOUNT} | profile: {PROFILE}. Cause: {CAUSE}" "patchProfile.arg2.notes: must not be empty" |
404 | "Profile not found - account: {ACCOUNT} | profile: {PROFILE}" "Profile library not found - account: {ACCOUNT} | profile: {PROFILE}" "Profile (legacy) not found - account: {ACCOUNT} | profile: {PROFILE}" "Users are currently viewing the same account: {ACCOUNT} | profile: {PROFILE}" "Latest version not found - {ACCOUNT} | profile: {PROFILE}" |
409 | "Error saving profile: {PROFILE} for account: {ACCOUNT}, duplicate versions: {VERSION}" |
500 | "Profile: {PROFILE} inherits from library profile" "Error saving profile metadata - account: {ACCOUNT} | profile: {PROFILE}" "Error saving profile - account: {ACCOUNT} | profile: {PROFILE}" "Error saving profile(legacy) - {ACCOUNT} | profile: {PROFILE}" |
This page was last updated: June 21, 2024