Call and show data from third party sources through the public end-point.
A POST request must be made to the endpoint with the following data structure depending on block type:
For example to update a metric block, call (JS):
const request = new XMLHttpRequest(); request.open('POST', 'YOUR_ENDPOINT_URL', true); request.setRequestHeader('Content-Type', 'application/json'); request.send(JSON.stringify({ data: { currentPeriod: { value: 15 }}}));
To update a chart block, call (JS):
const request = new XMLHttpRequest(); request.open('POST', 'YOUR_ENDPOINT_URL', true); request.setRequestHeader('Content-Type', 'application/json'); request.send(JSON.stringify({ data: [{ group: 'myGroup', value: 10 }], labels: { myGroup: 'Label' }} ));
Metric block:
Field | Type | Description |
data | Object | Data object |
data.currentPeriod | Object | Current period data object |
data.currentPeriod.value | Number | Current period value |
data.previousPeriod | Object | Previous period data object |
data.previousPeriod.value | Number | Previous period value |
Chart block:
Field | Type | Description |
data | Array | Data list |
data.$ | Object | Data list item |
data.$.group | String or Number | Data key |
data.$.value | String or Number | Data value |
colors | Object | Object key must be a valid 'group' value in 'data' Object value must be a valid hex string in format of #XXXXXX For example, if your 'data' is [{ group: 'dataGroup', value: 5 }], in order to set the color for that item, colors object would be { dataGroup: '#XXXXXX'} |
labels | Object | Object key must be a valid 'group' value in 'data' Object value must be a string. For example, if your 'data' is [{ group: 'dataGroup', value: 5 }], in order to set the label for that item, colors object would be { dataGroup: 'Label'} |
labelX | String | Label for X axis |
labelY | String | Label for Y axis |