Metric API

This article provides sample API calls to manipulate Metrics.

PREREQUISITES:

Access Admin > System > API Tool Kit

1. Get all Metrics

Get all Metrics

Filter out all Metrics currently existing in the system, followed by the key information per each of them (such as measure, name description, category, data source, dimension, etc.)

  1. Item: metric
  2. Method: GET
  3. Request URL (generated automatically)https://<hostname>.com/api/metric
  4. Run request

2. Return Information about a specific Metric

Return Information about a specific Metric

You can obtain all the information about a specific Metric (such as measure, name, description, category, data source, dimension, etc.)

  1. Item: metric
  2. Method: GET
  3. ID: Specify the ID of the Metric you wish to get information about. Metric ID can be determined in the web browser URL of the Metric Editor. For example:
https://<hostname>.com/chart/index/index/element/55
  1. Request URL (generated automatically): https://<hostname>.com/api/metric/<id>
  2. Run request

3. Get :last_measurement_time Example

Get :last_measurement_time

You can find the date that a metric/dimension was last updated.

  1. Item: element_info
  2. Method: GET
  3. Define the following parameters:
    • element (numeric value) - element id
    • dimension_value (numeric value) - dimension value id (for dimensioned elements)

These parameters can be determined in the web browser URL of the Metric Viewer. For example:

https://<hostname>.com/chart/index/index/element/1555/segment/2608

  1. Run request

4. Get Metrics Based on "User" Criteria

Get :last_measurement_time

You can display metrics based on a single, or combination of,  "user" fields. In this example, you can find all metrics based on combination of Category, Business Owner, and Tag.

  1. Item: element_info
  2. Method: GET
  3. Category: Id from the URL or Category Name
  4. Business Owner: Use Owner Name, email, or Username
  5. Tag: Tag name or Tag-id
  6. Run request

5. Delete measurements for a certain Time Range

Delete measurements for a certain Time Range

You can delete a range of values from a Metric.

  1. Item: metric
  2. Method: PUT
  3. ID: Specify the ID of a Metric you wish to get information about. Metric ID can be determined in the web browser URL of the Metric Viewer. For example:

https://<hostname>.com/editor/metric/edit/element/2037

  1. Actions: Choose to Delete Data. Your choice will automatically define a value in the call field below
  2. Set to Form request
  3. Define values for the following parameters:
    • delete_measurements_from: (measurement time should be in one of the following formats: yyyy-mm-dd or yyyy-mm-dd 00:00:00) - date from which measurements will be deleted
    • delete_measurements_through: (measurement time should be in one of the following formats: yyyy-mm-dd or yyyy-mm-dd 00:00:00) - date through which measurements will be deleted
  4. Run request