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.
iQ Variables API only works with profiles that do not inherit other libraries. If a profile inherits a library, it cannot be accessed with this endpoint. Likewise, library profiles cannot be accessed by this endpoint.
Example cURL request
`curl --location --request PATCH 'https://platform.tealiumapis.com/v3/tiq/{account}/profiles/{profile}' \
--header 'Authorization: Bearer eyJ0eXAiOi...' \
--header 'Content-Type: application/json' \
--data-raw ' `
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.
See the Tealium API V3 Getting Started guide to learn about generating a bearer token from the API key.
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 . |
parentVersion |
String | Optional | The originating profile version for the save or saveAs operations. |
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 (for replace/remove) |
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 replace/remove) |
The variable title. |
value.notes |
String | Optional | Notes about the variable. |
value.alias |
String | Required | The variable name. |
value.type |
String | Required | A prefix representing the variable type.udo - Universal Data Objectqp - Query string parametercp - Cookiejs_page - JavaScript page variablemeta - Meta data elementva - AudienceStream attribute |
Example Profile object
{
"versionTitle": "My New Variable",
"saveType": "saveAs",
"notes": "Added by v3 API",
"operationList": [
{
"op": "add",
"path": "/variables",
"value": {
"object": "variable",
"name": "updated",
"notes": "updated",
"alias": "updated",
"type": "udo"
}
}
]
}
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 Body
{
"versionTitle": "My New Variable",
"saveType": "saveAs",
"notes": "Added by v3 API",
"operationList": [
{
"op": "add",
"path": "/variables",
"value": {
"object": "variable",
"name": "updated",
"notes": "updated",
"alias": "updated",
"type": "udo"
}
}
]
}
Update variable
This PATCH method takes a profile variable object and additional variable fields.
Example Body
{
"versionTitle": "My New Variable",
"saveType": "saveAs",
"notes": "Added by v3 API",
"operationList": [
{
"op": "replace",
"path": "/variables/503",
"value": {
"object": "variable",
"name": "updated",
"notes": "updated",
"alias": "updated",
"type": "udo"
}
}
]
}
Delete variable
This PATCH method takes a profile variable object and additional variable fields.
Example request
{
"versionTitle": "My New Variable",
"saveType": "saveAs",
"notes": "Added by v3 API",
"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 - variabled: {variableID} | {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: January 30, 2023