REST API Integration Overview

This section details Anodot HTTP APIs. The APIs:

  • Allow you to easily send metric data points to Anodot.
  • Use resource-oriented URLs, status codes to indicate the success or failure of requests and return JSON from all requests.

AUTHENTICATION

All requests to Anodot's API must be authenticated  and require an API token. To have access to Token Management you must be an Admin user. See Token Management.

DEFINITION 

POST https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20

DESCRIPTION

Anodot 2.0 metrics protocol works with a structured name schema, it expects key-value pairs of properties.

This enables Anodot to understand the metric dimensions and what is being measured (the "what" property).  

See 
Metrics 2.0 Protocol definitions
Metrics 2.0 Format definitions

In legacy cases where the metrics cannot be represented in Metrics 2.0 Format, use Metrics 1.0 format.

See 
Metrics 1.0 Protocol definitions
Metrics 1.0 Format definitions  

RECOMMENDATIONS

  • Use the following properties:
    • A property name “unit”. The unit value will be shown in the metrics UI, alerts and dashboards.  
    • A property name “ver”. The “ver” property will treated as a metric version property to ease the maintenance and deletion of metrics during the integration.
  • Always put a target_type explicitly per data point. The target_type property represents how samples of the same metric are aggregated in Anodot.
    Valid values are: gauge (average aggregation), counter (sum aggregation).
  • Use identical  properties names and values across all metrics even if their data source is different.
    For example:
    • Sessions by device_type (desktop, mobile, tablet) and orders by device (DESKTOP, TABLET, MOBILE).
      In this case we recommend for both metrics that the property name will be the same in both metrics (either device or device_type).
      The similar values must be the same as well (either lowercase or uppercase).
  • Metric tags are optional and can be considered as metadata of the metric. Tags do not affect the uniqueness of the metric name/definition.
    In the Anodot portal, you can search by tags and properties.
  • The timestamp of when the metric sample was measured in Unix epoch time in seconds as a whole number (Integer).
    The timestamp should be at the most 1 hour in the future.
  • Expect the sample array to be sorted by the sample timestamp; samples are processed in the order they appear in the given JSON array - out-of-order samples (in the context of the same metric) will be discarded.
  • The “value” field must be a decimal double precision number without thousands separator. For example: 5.12345, 50000.45 etc

EXAMPLE REQUEST [1]

curl \
-X POST \
-d "[{"properties":{"what":"NumberPurchases","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes","target_type":
"counter"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876178,"value":58}]" \
-H "Content-Type: application/json" \
'https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20'

 EXAMPLE REQUEST [2]  Includes 2 metric samples

curl \
-X POST \
-d "[{"properties":{"what":"NumberPurchases","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes","target_type":"counter"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876178,"value":58},{"properties":{"what":
"Revenue","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876191,"value":3458.423}]" \
-H "Content-Type: application/json" \
'https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20'

Note

Expect the sample array to be sorted by the sample timestamp; samples are processed in the order they appear in the given JSON array - out-of-order samples (in the context of the same metric) will be discarded.

EXAMPLE RESPONSE 

{
    "errors": []
}

 
For more details about example responses, see HTTP Responses
Was this article helpful?
0 out of 0 found this helpful
-->