POST Stats/Query
Returns operational report data in JSON format for use in other applications. The information is also available in the Venafi MMC Snap-In Collection. For more information, see Install the Venafi MMC Snap-In Collection.
The following diagram shows how Stats/Query input parameters map to the Statistics report that appears in Venafi Statistics:
Requirements
- Permissions: The caller is not required to have any special permissions. Counters are public information unless they have the Sensitive flag set.
- Token scope: Statistics
Headers
-
Content type: Content-Type:application/json.
- Token: The bearer access token that you received. For example, Authorization:Bearer 4MyGeneratedBearerTknz==. For more information, see Passing a bearer token in your API calls.
Parameters
Name |
Description |
---|---|
StatsType |
The internal code for a reporting counter. To get this value, call POST Stats/GetCounters. |
Tier |
The time frame for this data: 1: Hour 2: Day 3: Month 4: Year |
MaxPoints |
The maximum number of distinct times that will be returned. For example, the number of X-axis points in a graph. |
GroupByA |
(Optional) Group the data by AName. To determine whether to set this flag, call POST Stats/GetCounters or specify the first item that appears in the Grouping box of the report.
If you want additional fine tuning, you can use this parameter in combination with GroupByB and GroupByC:
|
GroupByB |
(Optional) If present, group the data by BName. To determine whether to set this flag, call POST Stats/GetCounters or specify the second item that appears in the Grouping box of the report. You can use this parameter in combination with GroupByA and GroupByC:
|
GroupByC |
(Optional) To determine whether to set this flag, call POST Stats/GetCounters or specify the third item that appears in the Grouping box of the report. You can use this parameter in combination with GroupByA and GroupByB:
|
FilterA |
(Optional) A string filter from the data set. Use an exact match, or startswith wildcard *. notation. For example, FilterA: DELETE /vedsdk/Certificates/*. You can use this filter in combination with any other filter or group. |
FilterB |
(Optional) A string filter from the data set. Use an exact match, or startswith wildcard *. notation. For example, FilterB: OK. You can use this filter in combination with any other filter or group. |
FilterC |
(Optional) A string filter from the data set. Use an exact match, or startswith wildcard *. notation. For example, FilterC: \\VED\\Identity\\ad*. You can use this filter in combination with any other filter or group. |
Returns
For invalid requests, Query/Stats returns:
- HTTP 404 Error.
For valid requests, this API returns a HTTP 200 message and the following data in the message body.
Name | Description |
---|---|
Results |
An array with a Key and a Value array with report data. The specific tagged data for this result set, provided at the most granular level possible for the query. Null if this field is not used by this counter or if all values are included in the data set.
|
Example 1: Filter Certificate API calls by identity
Request for Example 1
POST https://test.venafi.example/vedsdk/Stats/Query Authorization:Bearer 4MyGeneratedBearerTknz== { "StatsType":"2686977", "Tier":"1", "MaxPoints":"100", "GroupByA":false, "GroupByB":true, "GroupByC":true, "FilterA":"POST /vedsdk/Certificates/*", "FilterB":"OK", "FilterC":"\\VED\\Identity\\ad*" }
Response for Example 1
HTTP/1.1 200 OK { "Results":[ { "Key":{ "m_Item1":null, "m_Item2":"OK", "m_Item3":"\\VED\\Identity\\admin" }, "Value":[ { "TagB":"OK", "TagC":"\\VED\\Identity\\admin", "TimeFrame":"2021-12-01T19:00:00.0000000Z", "Type":-1 }, { "TagB":"OK", "TagC":"\\VED\\Identity\\admin", "TimeFrame":"2021-12-01T19:00:00.0000000Z", "Type":-1 }, { "TagB":"OK", "TagC":"\\VED\\Identity\\admin", "TimeFrame":"2021-12-01T19:00:00.0000000Z", "Type":-1 }, ... } ] } ] }
Example 2: Query system activity for a particular time period
Request for Example 2
POST https://test.venafi.example/vedsdk/Stats/Query Authorization:Bearer 4MyGeneratedBearerTknz== { "StatsType":"2752513", "Tier":"2", "MaxPoints":"10", "GroupByA":true, "GroupByB":false, "GroupByC":false }
Response for Example 2
HTTP/1.1 200 OK { "Results":[ { "Key":{ "m_Item1":"Day", "m_Item2":null, "m_Item3":null }, "Value":[ { "Count":1, "SumValue":12, "TagA":"Day", "TimeFrame":"2020-02-01T00:00:00.0000000Z", "Type":2752513 }, { "TagA":"Day", "TimeFrame":"2020-02-02T00:00:00.0000000Z", "Type":-1 },... { "TagA":"Day", "TimeFrame":"2020-02-03T00:00:00.0000000Z", "Type":-1 }, { "TagA":"Day", "TimeFrame":"2020-02-04T00:00:00.0000000Z", "Type":-1 }, { "TagA":"Day", "TimeFrame":"2020-02-05T00:00:00.0000000Z", "Type":-1 }, { "TagA":"Day", "TimeFrame":"2020-02-06T00:00:00.0000000Z", "Type":-1 }, { "TagA":"Day", "TimeFrame":"2020-02-07T00:00:00.0000000Z", "Type":-1 }, { "TagA":"Day", "TimeFrame":"2020-02-08T00:00:00.0000000Z", "Type":-1 }, { "TagA":"Day", "TimeFrame":"2020-02-09T00:00:00.0000000Z", "Type":-1 }, { "TagA":"Day", "TimeFrame":"2020-02-10T00:00:00.0000000Z", "Type":-1 } ] }, { "Key":{ "m_Item1":"Hour", "m_Item2":null, "m_Item3":null }, "Value":[ { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-01T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-02T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":3, "TagA":"Hour", "TimeFrame":"2020-02-03T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-04T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-05T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-06T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-07T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":33, "TagA":"Hour", "TimeFrame":"2020-02-08T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-09T00:00:00.0000000Z", "Type":2752513 }, { "Count":1, "SumValue":2, "TagA":"Hour", "TimeFrame":"2020-02-10T00:00:00.0000000Z", "Type":-1 } ] }, { "Key":{ "m_Item1":"Live", "m_Item2":null, "m_Item3":null }, "Value":[ { "Count":24, "SumValue":3, "TagA":"Live", "TimeFrame":"2020-02-01T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "SumValue":3, "TagA":"Live", "TimeFrame":"2020-02-02T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "SumValue":2, "TagA":"Live", "TimeFrame":"2020-02-03T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "SumValue":1, "TagA":"Live", "TimeFrame":"2020-02-04T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "SumValue":21, "TagA":"Live", "TimeFrame":"2020-02-05T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "SumValue":2, "TagA":"Live", "TimeFrame":"2020-02-06T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "SumValue":2, "TagA":"Live", "TimeFrame":"2020-02-07T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "TagA":"Live", "TimeFrame":"2020-02-08T00:00:00.0000000Z", "Type":2752513 }, { "Count":24, "SumValue":1, "TagA":"Live", "TimeFrame":"2020-02-09T00:00:00.0000000Z", "Type":2752513 }, { "Count":23, "TagA":"Live", "TimeFrame":"2020-02-10T00:00:00.0000000Z", "Type":-1 } ] } ] }