Skip to main content
Custom Metrics API
Updated over a month ago

The custom metrics API can be used to add arbitrary time series data to your Data Cloud instance. It allows you to store value numbers by reference and key pairs. An additional metadata object can be provided for each record. The records are stored in the custom_metrics table that is queryable in Data Studio alongside all of your other Data Cloud data.

For more information about the supported SQL operators and functions available for querying the JSON values please reference the PostgreSQL documentation.

API Methods

customMetrics.push

Append a time series record by reference and key pair.

Required Arguments

Name

Description

reference

String - The domain reference.

key

String - The domain key.

value

Number - The value to be stored.

Optional Arguments

Name

Description

metadata

JSON Object - The object to be stored.

timestamp

String - ISO8601 timestamp. This will default to when the request is received if not included.

Response

Name

Description

id

String - Generated unique ID for the record.

reference

String - The received reference argument.

key

String - The received key argument.

value

Number - The received value argument.

metadata

JSON Object - The received metadata argument.

timestamp

String - ISO8601 timestamp. The received timestamp argument, or generated timestamp.

Example

curl -X POST https://yourinstance.getdx.net/api/customMetrics.push \
-H 'Accepts: application/json' \
-H 'Authorization: Bearer your_bearer_token_here' \
-H 'Content-Type: application/json' \
--data '{
"reference”: “orgname/service”,
"key”: “example”,
"value”: 42.5,
“metadata”: { “other”: “data” },
"timestamp": "2024-01-01T11:22:33"
}'

customMetrics.list

Retrieve a collection of time series records by reference and key pair. Each response is limited to returning 100 records. The from timestamp argument can be used to implement pagination.

Required Arguments

Name

Description

reference

String - The domain reference.

key

String - The domain key.

Optional Arguments

Name

Description

order

String - Either asc or desc. Defaults to asc.

from

String - ISO8601 timestamp. Filter records using the specified timestamp and order.

Response

Name

Description

total

Integer - The number of records matching the criteria.

data

Array - The records matching the criteria.

Data

Name

Description

id

String - Generated unique ID for the record.

reference

String - The received reference argument.

key

String - The received key argument.

value

Number - The received value argument.

metadata

JSON Object - The received metadata argument.

timestamp

String - ISO8601 timestamp. The received timestamp argument, or generated timestamp.

Example

curl https://yourinstance.getdx.net/api/customMetrics.list?reference=orgname/service&key=example \
-H 'Accepts: application/json' \
-H 'Authorization: Bearer your_bearer_token_here'

customMetrics.delete

Delete a record by unique ID.

Required Arguments

Name

Description

id

String - Generated unique ID for the record.

Response

Name

Description

id

String - Generated unique ID for the record.

reference

String - The received reference argument.

key

String - The received key argument.

value

Number - The received value argument.

metadata

JSON Object - The received metadata argument.

timestamp

String - ISO8601 timestamp. The received timestamp argument, or generated timestamp.

Example

curl -X POST https://yourinstance.getdx.net/api/customMetrics.delete \
-H 'Accepts: application/json' \
-H 'Authorization: Bearer your_bearer_token_here' \
-H 'Content-Type: application/json' \
--data '{
“id”: “399599e8-a526-4073-ba7f-cfada89adfa0”
}'
Did this answer your question?