Create a version of a reusable definition
curl --request POST \
--url https://app.chatobserver.com/api/v2/metrics/definitions/{resourceType}/{resourceId}/versions \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-chatobserver-key: <api-key>' \
--data '
{
"definition": {
"schemaVersion": 2,
"expression": {
"kind": "literal",
"value": "<string>"
},
"currencyContext": {
"sourceCurrencyFieldId": "<string>",
"targetCurrency": "<string>"
},
"dateContext": {
"timeZone": "<string>",
"locale": "<string>"
},
"validationFixtures": [
{
"expected": "<string>",
"name": "<string>",
"input": {}
}
]
}
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'x-chatobserver-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
definition: {
schemaVersion: 2,
expression: {kind: 'literal', value: '<string>'},
currencyContext: {sourceCurrencyFieldId: '<string>', targetCurrency: '<string>'},
dateContext: {timeZone: '<string>', locale: '<string>'},
validationFixtures: [{expected: '<string>', name: '<string>', input: {}}]
}
})
};
fetch('https://app.chatobserver.com/api/v2/metrics/definitions/{resourceType}/{resourceId}/versions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.chatobserver.com/api/v2/metrics/definitions/{resourceType}/{resourceId}/versions"
payload = { "definition": {
"schemaVersion": 2,
"expression": {
"kind": "literal",
"value": "<string>"
},
"currencyContext": {
"sourceCurrencyFieldId": "<string>",
"targetCurrency": "<string>"
},
"dateContext": {
"timeZone": "<string>",
"locale": "<string>"
},
"validationFixtures": [
{
"expected": "<string>",
"name": "<string>",
"input": {}
}
]
} }
headers = {
"Idempotency-Key": "<idempotency-key>",
"x-chatobserver-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"actorId": "<string>",
"canonicalHash": "<string>",
"resourceId": "<string>",
"resourceType": "model",
"versionId": "<string>",
"versionNumber": 123,
"versionStatus": "<string>"
},
"replayed": false
}{
"data": {
"actorId": "<string>",
"canonicalHash": "<string>",
"resourceId": "<string>",
"resourceType": "model",
"versionId": "<string>",
"versionNumber": 123,
"versionStatus": "<string>"
},
"replayed": false
}{
"error": {
"code": "internal",
"fieldPath": [
"<string>"
],
"parameters": {},
"repairActions": [
"<string>"
],
"requestId": "<string>",
"retryable": false,
"retryAfterSeconds": 1
}
}Data definitions
Create a version of a reusable definition
Manage reusable definitions and their immutable versions.
POST
/
api
/
v2
/
metrics
/
definitions
/
{resourceType}
/
{resourceId}
/
versions
Create a version of a reusable definition
curl --request POST \
--url https://app.chatobserver.com/api/v2/metrics/definitions/{resourceType}/{resourceId}/versions \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-chatobserver-key: <api-key>' \
--data '
{
"definition": {
"schemaVersion": 2,
"expression": {
"kind": "literal",
"value": "<string>"
},
"currencyContext": {
"sourceCurrencyFieldId": "<string>",
"targetCurrency": "<string>"
},
"dateContext": {
"timeZone": "<string>",
"locale": "<string>"
},
"validationFixtures": [
{
"expected": "<string>",
"name": "<string>",
"input": {}
}
]
}
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'x-chatobserver-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
definition: {
schemaVersion: 2,
expression: {kind: 'literal', value: '<string>'},
currencyContext: {sourceCurrencyFieldId: '<string>', targetCurrency: '<string>'},
dateContext: {timeZone: '<string>', locale: '<string>'},
validationFixtures: [{expected: '<string>', name: '<string>', input: {}}]
}
})
};
fetch('https://app.chatobserver.com/api/v2/metrics/definitions/{resourceType}/{resourceId}/versions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.chatobserver.com/api/v2/metrics/definitions/{resourceType}/{resourceId}/versions"
payload = { "definition": {
"schemaVersion": 2,
"expression": {
"kind": "literal",
"value": "<string>"
},
"currencyContext": {
"sourceCurrencyFieldId": "<string>",
"targetCurrency": "<string>"
},
"dateContext": {
"timeZone": "<string>",
"locale": "<string>"
},
"validationFixtures": [
{
"expected": "<string>",
"name": "<string>",
"input": {}
}
]
} }
headers = {
"Idempotency-Key": "<idempotency-key>",
"x-chatobserver-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"actorId": "<string>",
"canonicalHash": "<string>",
"resourceId": "<string>",
"resourceType": "model",
"versionId": "<string>",
"versionNumber": 123,
"versionStatus": "<string>"
},
"replayed": false
}{
"data": {
"actorId": "<string>",
"canonicalHash": "<string>",
"resourceId": "<string>",
"resourceType": "model",
"versionId": "<string>",
"versionNumber": 123,
"versionStatus": "<string>"
},
"replayed": false
}{
"error": {
"code": "internal",
"fieldPath": [
"<string>"
],
"parameters": {},
"repairActions": [
"<string>"
],
"requestId": "<string>",
"retryable": false,
"retryAfterSeconds": 1
}
}Required scopes:
metrics:write.Authorizations
WorkspaceKeyBearerKey
A workspace API key. Data endpoints require a service-account key with the specified scopes.
Headers
Unique key for one logical command. Reuse it only when retrying the same request and payload.
Required string length:
16 - 160Pattern:
^[A-Za-z0-9:_-]+$Path Parameters
The definition collection. The definition body must match this resource type.
Available options:
custom-fields, blends, models, table-groups, imported-datasets, client-bindings Resource identifier returned by the API.
Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
Show child attributes
Show child attributes