Multi-Metric API

This article provides sample API calls to manipulate Metrics.

PREREQUISITES:

Return Information about a Multi-metric

API:

https://yourinstance.metricinsights.com/api/multimetric/id/<multimetric_id>

Example:

https://yourinstance.metricinsights.com/api/metric/id/61

Method: GET

Header:

Accept:application/json
Token:UClCUUKxUlkdbhE1cHLz3kyjbIZYVh9eB34A5Q21Y3FPqKGSJs

Response:

{
	"multimetric": {
    	"id": "61",
    	"name": "DG MM v1",
    	"description": "DG MM v1 Multi-Metric",
    	"dimension": "0",
    	"category": "14",
    	"business_owner_id": "24",
    	"technical_owner_id": "24",
    	"stoplight_segment": "0",
    	"left_y_axis_title": "DG Monthly Customers",
    	"right_y_axis_title": "od Monthly Sales",
    	"can_be_viewed_without_login": "no",
    	"start_right_axis_from_zero": "no",
    	"stack_bars": "no",
    	"include_multimetric_data_table_in_e_mail_digests": "no",
    	"display_data_table": "no"
	}
}

Multi-metric Associate Elements

API:

https://yourinstance.metricinsights.com/api/api/multimetric_association?element=<element_id>

Parameters:

  • element (numeric value) - element id

Example:

https://adam.metricinsights.com/api/multimetric_association?element=4422

Method: GET

Header:

Accept:application/json
Token:UClCUUKxUlkdbhE1cHLz3kyjbIZYVh9eB34A5Q21Y3FPqKGSJs

Response:

{
	"multimetric_associations": [
    	{
        	"id": "3458",
        	"measurement_interval": "4",
        	"measurement": "Weekly",
        	"element": "4422",
        	"association_element": "5292",
        	"name": "Total Weekly Sales"
    	},
    	{
        	"id": "3460",
        	"measurement_interval": "6",
        	"measurement": "Monthly",
        	"element": "4422",
        	"association_element": "64",
        	"name": "Profit Analysis II"
    	},
    	{
        	"id": "3462",
        	"measurement_interval": "9",
        	"measurement": "Quarterly",
        	"element": "4422",
        	"association_element": "3877",
        	"name": "de metric 1"
    	},
    ]
}

Delete measurements for a certain Time Range

API:

https://yourinstance.metricinsights.com/api/multimetric/id/<multimetric_id>

Example:

https://mi41.metricinsights.com/api/multimetric/id/61

Method: PUT

Call: delete_data

Header:

Accept:application/json
Token:UClCUUKxUlkdbhE1cHLz3kyjbIZYVh9eB34A5Q21Y3FPqKGSJs

Request example  (simple Multi-metrics):

{
	"call": "delete_data",
	"delete_measurements_from": "2014-01-02 00:00:00",
	"delete_measurements_through": "2014-03-26 00:00:00"
}

Request example  (dimensioned Multi-metrics):

{
	"call": "delete_data",
	"delete_measurements_from": "2014-02-01 00:00:00",
	"delete_measurements_through": "2014-10-01 00:00:00",
	"dimension_value": "Product Category Total"
}

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

Response:

{
"status": "OK"
}