This article provides sample API calls to manipulate Reports.
PREREQUISITES:
- Set up API access
- Verify that you have API access
- Obtain a token via a get token call since all API calls require a token
Access Report Data for JavaScript Charting
Get Report Information
You can obtain all the information about a specific Report (such as Measurement Interval, Report type, Name, Description, Category, whether it is a Change Report, etc.)
- Item: report
- Method: GET
- 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://<hostname>/editor/report/edit/element/2- Input Token generated for the External Application
- [Run request]
Get Report's Historical Instance IDs
API:
https://<hostname>/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://<hostname>/api/report_instance?element=81
Dimensioned Report - https://<hostname>/api/report_instance?element=81&dimension_value=6Header:
Accept:application/json
Token:UClCUUKxUlkdbhE1cHLz3kyjbIZYVh9eB34A5Q21Y3FPqKGSJsRequest 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"
    	},
	]
}