Report Data API

This article provides sample API calls to manipulate Reports.

PREREQUISITES:

  1. Set up API access
  2. Verify that you have API access
  3. Obtain a token via a get token call since all API calls require a token

Get Report Information

You can obtain all the information about a specific Metric (such as measurement inteval, report type, name, description, category, whether it is a change report, etc.)

  1. Item: report
  2. Method: GET
  3. ID: Specify the ID of a Report you wish to get information about. Report ID can be determined in the web browser URL of the Report Editor. For example:
https://demo.metricinsights.com/editor/report/edit/element/2
  1. Run request

Set time range ('from_measurement_time' and 'to_measurement_time' values)

  1. Item: report
  2. Method: PUT
  3. ID: Specify the ID of a Report you wish to modify. Report ID can be determined in the web browser URL of the Report Editor. For example:
https://demo.metricinsights.com/editor/report/edit/element/154
  1. Actions: Select an action you wish to perform. NOTE: Specific time range is defined for "Delete data" and "Update live Report"
  2. call: This field is going to be automatically populated based on the action you have chosen at the field above
  3. Specify the time range by defining the following parameters:
    • from_measurement_time - (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 updated
    • to_measurement_time- (measurement time should be in one of the following formats: yyyy-mm-dd or yyyy-mm-dd 00:00:00) - date to which measurements will be updated
  4. Run request

Change ':measurement_time' value

Change ':measurement_time' value

To learn more about the :measurement_time bind variable, follow this link.

  1. Item: report
  2. Method: PUT
  3. ID: Specify the ID of a Report you wish to modify. Report ID can be determined in the web browser URL of the Report Editor. For example:
https://demo.metricinsights.com/editor/report/edit/element/2
  1. custom_effective_date: (Value or id of a period. Sample correlation :Last week = 1, Yesterday = 2, Today =7) - sets ':measurement_time' value
  2. Run request

Delete measurements for a certain Time Range

  1. Item: report
  2. Method: PUT
  3. ID: Specify the ID of a Report you wish to modify. Report ID can be determined in the web browser URL of the Report Editor. For example:
https://demo.metricinsights.com/editor/report/edit/element/154
  1. Actions: "Delete data"
  2. call: This field is automatically populated based on the action you have chosen at the field above
  3. Specify the time range by defining the following parameters:
    • from_measurement_time - (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 updated
    • to_measurement_time- (measurement time should be in one of the following formats: yyyy-mm-dd or yyyy-mm-dd 00:00:00) - date to which measurements will be updated
  4. Run request

Get Report's Historical Instance IDs

API:

https://yourinstance.metricinsights.com/api/report_instance?element=<element_id>&dimension_value=<dimension_value_id>

Parameters:

  • element (numeric value) - element ID
  • dimension_value (numeric value) - Dimension Value ID (for dimensioned elements only)

Example:

Undimensioned Report - https://yourinstance.metricinsights.com/api/report_instance?element=81
Dimensioned Report - https://yourinstance.metricinsights.com/api/report_instance?element=81&dimension_value=6

Header:

Accept:application/json
Token:UClCUUKxUlkdbhE1cHLz3kyjbIZYVh9eB34A5Q21Y3FPqKGSJs

Request example :

{
"call": "generate",
"from_measurement_time": "2016-04-24",
"to_measurement_time": "2016-04-25"
}

Response (without dimension value specified):

{
	"report_instances": [
    	{
        	"id": "915",
        	"element": "81",
        	"dimension_value": "5",
        	"measurement_time": "2014-01-01 00:00:00"
    	},
    	{
        	"id": "918",
        	"element": "81",
        	"dimension_value": "8",
        	"measurement_time": "2014-01-01 00:00:00"
    	},
    	
   ]
}

Response (without dimension value specified):

{
	"report_instances": [
    	{
        	"id": "916",
        	"element": "81",
        	"dimension_value": "6",
        	"measurement_time": "2014-01-01 00:00:00"
    	},
    	{
        	"id": "804",
        	"element": "81",
        	"dimension_value": "6",
        	"measurement_time": "2014-02-01 00:00:00"
    	},
	]
}

Set historical instances to be backfilled

  1. Item: report
  2. Method: PUT
  3. ID: Specify the ID of a Report you wish to modify. Report ID can be determined in the web browser URL of the Report Editor. For example:
https://demo.metricinsights.com/editor/report/edit/element/2
  1. keep_history: (yes, no) - When this option is set to 'yes', the Snapshot reporting is enabled (an instance for every data collection run is saved)
  2. can_historical_instances_be_backfilled: (yes, no) - Define whether historical instances of a snapshot report be backfilled when data is recollected. Backfilling is performed within the ':measurement_time' parameter time range
  3. Run request

0 Comments

Add your comment

E-Mail me when someone replies to this comment