Get Dashboard/Widget value from Cortex XSOAR

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Get Dashboard/Widget value from Cortex XSOAR

L1 Bithead

I created API key in setting and trying to get the dashboard/widget value (e.g. Playbook runs) from XSOAR but failed.

 

ce13_0-1663730334768.png

 

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.

1 accepted solution

Accepted Solutions

L2 Linker

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.

tyler_bailey_0-1663763492899.png

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!

View solution in original post

2 REPLIES 2

L2 Linker

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.

tyler_bailey_0-1663763492899.png

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!

Thanks. I am able to get the value through API query.

  • 1 accepted solution
  • 2170 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!