Skip to content

Metrics

Download

Method: Get

Path: /api/v1/metrics/download

Parameters:

  • metrics: Single Metric name or string to use with pattern.
  • pattern: With a pattern you can download more than one metric. Pattern uses the text in metrics to filter the data. Valid values are:
    • single: match metrics exactly
    • list: comma separated list each element matching metrics exactly from the list of your entitled metrics.
    • contains: metric name contains metrics
    • starts_with: metric name starts with metrics
    • ends_with: metric name ends with metrics
  • start_date: Format YYYY-MM-DD
  • end_date: Format YYYY-MM-DD
  • max_rows: default is 1000. (More than 10000 might cause a timeout)
  • file_format: csv or json

Response

metric_name,timestamp,metric_numeric_value,updated_at
0230523053:throughput,2023-10-03T20:43:52+0000,0.0,2023-10-12T20:43:53+0000
0230523053:throughput,2023-10-03T20:43:52+0000,0.0,2023-10-12T20:43:53+0000
0230523053:throughput,2023-10-03T20:43:52+0000,0.0,2023-10-12T20:43:53+0000
0230523054:throughput,2023-10-03T20:44:07+0000,0.0,2023-10-12T20:44:08+0000
0230523054:throughput,2023-10-03T20:44:07+0000,0.0,2023-10-12T20:44:08+0000
0230523054:throughput,2023-10-03T20:44:07+0000,0.0,2023-10-12T20:44:08+0000
0230523054:throughput,2023-10-03T20:44:07+0000,0.0,2023-10-12T20:44:08+0000

Code Examples

Check here for endpoint address.

metricname / start_date / end_date must be URL encoded if they contain special characters

curl --location '<ENDPOINT>/api/v1/metrics/download?\
start_date=2023-10-01T23%3A00%3A00-04%3A00%3A00&\
end_date=2023-11-01T23%3A00%3A00-04%3A00%3A00&\
format=csv&\
max_rows=1000&\
metrics=0230523053%3Athroughput%2C0230523054%3Athroughput' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR API KEY>'


File Upload

Method: Post

Path: /api/v1/metrics_file_upload

Parameters:

  • metric_name: URL encoded metrice name

Payload:

  • file: Full path of file to uplaod

Review this page for file format details

Returns: Background Task ID

{
    "task_id": "1dd1ce46-62cc-486e-9f47-1f96c1895b25"
}

Review this page to follow a background task

Code Examples

Check here for endpoint address.

curl --location '<ENDPOINT>/api/v1/metrics_file_upload?metric_name=<metricname>' \
--header 'Content-Type: multipart/form-data' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR API KEY>' \
--form 'file=@"/path/to/file"'
import requests
url = "<ENDPOINT>/api/v1/metrics_file_upload?metric_name=<metricname>"
payload = {}
files=[
('file',('<FILE NAME>',open('/<FULL FILE PATH>','rb'),'text/csv'))
]
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR API KEY>'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)

JSON Upload

Method: Post

Path: /api/v1/metrics/upload

Payload:

{ "metric_name" : "<Metric Name>",
  "values": [
        {"timestamp": "YYYY-MM-DDTHH:MM:SS-0000", "value": <value>},
            ]
}
Review this page for date format details

Returns: Background Task ID

{
    "task_id": "1dd1ce46-62cc-486e-9f47-1f96c1895b25"
}

Review this page to follow a background task

Code Examples

Check here for endpoint address.

curl --location '<ENDPOINT>/api/v1/metrics/upload' \
--header 'Content-Type: multipart/form-data' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR API KEY>' \
--data '{
    "metric_name": "02024405:throughput",
    "values": [
        {
            "timestamp": "2023-10-01T11:55:53-0400" ,
            "value": 1.0
        }
    ]
}'
import requests
import json

url = "<ENDPOINT>/api/v1/metrics/upload"

payload = json.dumps({"metric_name": "<metricname>",
        "values": [
            {"timestamp": "2022-01-01T03:01:00Z","value": 1.0 },
        ]
        })
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR API KEY>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)