Target API
This article provides sample API calls to manipulate Targets.
PRE-REQUISITES:
- Set up API access
- Verify that you have API access OR get token call via curl since all API calls require a token.
Create a new Target
Item: target
Method: POST
Header:
Accept:application/json
Token:pp7463NsgbECHh5XIwfMLS5of8qFD5j4G3QohTCMh72kHyXH3K
Request example:
{
"name": "Daily Revenue Target",
"target_type": "1",
"measure": "3",
"dimension": "0",
"measurement_interval": "3",
"xtd_rollup_type": "calendar",
"target_value_type": "integer"
}
NOTE: Target Name and combination of Target Type, Measure, Dimension and Measurement Interval must be unique across the system.
Add Datapoint
Item: target_data
Method: POST
Header:
Accept:application/json
Token:1aoPDXz570JYvgpVtKLGkRMrpc8XfB8ZGEYGIteYKjG4hmoIsw
Request example:
{
"target": "95",
"date": "2013-18-03",
"value": "100"
}
Add Association
Item: target_metric
Method: POST
Header:
Accept:application/json
Token:1aoPDXz570JYvgpVtKLGkRMrpc8XfB8ZGEYGIteYKjG4hmoIsw
Request example:
{
"target": "80",
"metric": "1396"
}
In this example an association between a Target 'Daily Bookings Forecast' (id 80) and a metric 'Daily Arrivals' (id 1396) has been established. In the Raw Response screen the id of this association is given ("id": "97").