- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
09-20-2022 08:22 PM
I created API key in setting and trying to get the dashboard/widget value (e.g. Playbook runs) from XSOAR but failed.
In the API guideline, there is no example of body parameters in "Get Dashboard Statistics" or "Get Widget Statistics", so I have no idea what should I input in order to get the value. Would someone please help for this? Thanks.
09-21-2022 05:36 AM
The parameter to the "Get Widget Statistics" API is a JSON object representing the widget. This object can be downloaded from the XSOAR GUI. When you are editing your widget there is a button at the bottom to download the widget as JSON.
This JSON file can then be used as the data to a POST request to /v2/statistics/widgets/query.
An example widget JSON object:
{
"id": "03b886ce-b254-4c70-8630-74231edf1170",
"version": 1,
"cacheVersn": 0,
"modified": "2022-05-31T12:49:27.330990346Z",
"packID": "",
"packName": "",
"itemVersion": "",
"fromServerVersion": "",
"toServerVersion": "",
"propagationLabels": [
"all"
],
"definitionId": "",
"vcShouldIgnore": false,
"vcShouldKeepItemLegacyProdMachine": false,
"commitMessage": "",
"shouldCommit": false,
"Cache": null,
"name": "Rate Limited API Calls",
"prevName": "Rate Limited API Calls",
"dataType": "metrics",
"widgetType": "number",
"query": "type:integration and apiResponseType:QuotaError",
"isPredefined": false,
"dateRange": {
"fromDate": "0001-01-01T00:00:00Z",
"toDate": "0001-01-01T00:00:00Z",
"period": {
"by": "",
"byTo": "",
"byFrom": "days",
"toValue": null,
"fromValue": 7,
"field": ""
},
"fromDateLicense": "0001-01-01T00:00:00Z"
},
"params": {
"keys": [
"sum|totalAPICalls"
],
"valuesFormat": "abbreviated"
},
"category": ""
}
Using that JSON object to query the API:
$ curl -k -X POST https://xsoar.local/v2/statistics/widgets/query --header "Authorization:<APIKEY>" --header "Content-Type:application/json" -d @widget.json
0
Hopefully that helps!
09-21-2022 05:36 AM
The parameter to the "Get Widget Statistics" API is a JSON object representing the widget. This object can be downloaded from the XSOAR GUI. When you are editing your widget there is a button at the bottom to download the widget as JSON.
This JSON file can then be used as the data to a POST request to /v2/statistics/widgets/query.
An example widget JSON object:
{
"id": "03b886ce-b254-4c70-8630-74231edf1170",
"version": 1,
"cacheVersn": 0,
"modified": "2022-05-31T12:49:27.330990346Z",
"packID": "",
"packName": "",
"itemVersion": "",
"fromServerVersion": "",
"toServerVersion": "",
"propagationLabels": [
"all"
],
"definitionId": "",
"vcShouldIgnore": false,
"vcShouldKeepItemLegacyProdMachine": false,
"commitMessage": "",
"shouldCommit": false,
"Cache": null,
"name": "Rate Limited API Calls",
"prevName": "Rate Limited API Calls",
"dataType": "metrics",
"widgetType": "number",
"query": "type:integration and apiResponseType:QuotaError",
"isPredefined": false,
"dateRange": {
"fromDate": "0001-01-01T00:00:00Z",
"toDate": "0001-01-01T00:00:00Z",
"period": {
"by": "",
"byTo": "",
"byFrom": "days",
"toValue": null,
"fromValue": 7,
"field": ""
},
"fromDateLicense": "0001-01-01T00:00:00Z"
},
"params": {
"keys": [
"sum|totalAPICalls"
],
"valuesFormat": "abbreviated"
},
"category": ""
}
Using that JSON object to query the API:
$ curl -k -X POST https://xsoar.local/v2/statistics/widgets/query --header "Authorization:<APIKEY>" --header "Content-Type:application/json" -d @widget.json
0
Hopefully that helps!
09-21-2022 06:19 PM
Thanks. I am able to get the value through API query.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!