It looks like the API documentation is incorrect for that API (and maybe others in that OrgStatisticsREST). That API only uses the simulations query parameter.
There is a POST version of that endpoint that takes the same POST body as
/orgs/{org_id}/incidents/query_paged
Richard mentioned. I can see it is not documented for some reason, but the UI uses it.
Here I have asked for incident status data for a given range of when incidents were created:
This looks like this API call:
curl -k 'https://server/rest/orgs/317/incidents/pivot' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/json' -H 'X-sess-id: 0dc2c272918156c876a48aa2a0e9f3d2' -H 'handle_format: ids' -H 'text_content_output_format: objects_convert' -H 'browser_locale: en' -H 'X-Requested-With: XMLHttpRequest' --H 'Connection: keep-alive' -H 'Cookie: _ga=GA1.2.1382814266.1575940211; JSESSIONID=CCF86C8B3202D705FD3F22C22BC54D13; CSRF_TOKEN=7b2276616c7565223a223734313265353438366262616230663161623162313663326336623938636230227d' --data-raw '{"filters":[{"conditions":[{"field_name":"plan_status","method":"in","value":["A"]},{"field_name":"create_date","method":"gte","value":1577854800000},{"field_name":"create_date","method":"lte","value":1639458000000}]}],"row_fields":[{"arguments":{"field_name":"plan_status"}}],"function":{"type":"count"}}'
This returns the data grouped in the way asked for.
If you play around with custom widgets on the UI you can see lots of options to use with the API.
If you don't need grouping and just need counts you can use the query_paged API and ask for 1 record to be returned (just makes it faster if the server does not have to return the actual data). It will return the count matched.
Ben
Ben
------------------------------
Ben Lurie
------------------------------
Original Message:
Sent: Tue January 12, 2021 11:13 PM
From: TCB SIRT
Subject: Making API Request to get Incidents Statistic?