The api/audit/sessions/histogram endpoint provides a histogram about the recorded sessions.
GET https://<IP-address-of-SPS>/api/audit/sessions/histogram
Cookie name | Description | Required | Values |
---|---|---|---|
session_id | Contains the authentication token of the user | Required |
The value of the session ID cookie received from the REST server in the authentication response, for example, a1f71d030e657634730b9e887cb59a5e56162860. For details on authentication, see Authenticate to the SPS REST API. Note that this session ID refers to the connection between the REST client and the SPS REST API. It is not related to the sessions that SPS records (and which also have a session ID, but in a different format). |
The following command retrieves statistical data about sessions.
curl --cookie cookies https://<IP-address-of-SPS>/api/audit/sessions/histogram
Use the following parameters to fine-tune your request for statistics:
?q: Narrow down the scope of the histogram using one or more properties (elements) of the sessions.
?field: Create a histogram for the selected properties (elements and values) of sessions (for example, protocol).
Using this parameter is mandatory.
?bin-size: Determines the size of the unit for the histogram, for example, hour. SPS splits the queried period to intervals of this unit, and returns the number of sessions to each interval. For example, if you query an histogram from 2018-02-12:14:40 to 2018-02-16:14:40, and you set the bin-size to day, then SPS will return five datasets (one for each day). If you set the bin-size to week, then SPS will return only one dataset.
?start: Create a histogram from the sessions that started after the specified date. Use the ISO 8601 format for the date, for example, 2017-01-25T10:00. By default, this is the one month before the date of the request.
?end: Create a histogram from the sessions that ended before the specified date. Use the ISO 8601 format for the date, for example, 2017-01-25T11:00. By default, this is the date of the request.
?size: Limit the range of values displayed in the histogram for a given field. The histogram will only be created for the top size number of most frequently occurring values (that is, values with the highest number of counts).
The following snippet is a sample response received when retrieving a histogram about the audited sessions.
For details of the meta object, see Message format.
Those fields of the meta object that are specific to histograms are described in table Element .
{ "body": { "buckets": [ { "active_count": 61, "id": "2018-01-15T12:00:00.000Z", "start_count": 61 }, { "active_count": 99, "id": "2018-01-15T13:00:00.000Z", "start_count": 89 }, { "active_count": 39, "id": "2018-01-15T14:00:00.000Z", "start_count": 24 }, { "active_count": 62, "id": "2018-01-15T15:00:00.000Z", "start_count": 62 }, { "active_count": 92, "id": "2018-01-15T16:00:00.000Z", "start_count": 81 }, { "active_count": 27, "id": "2018-01-15T17:00:00.000Z", "start_count": 19 } ] }, "key": "histogram", "meta": { "bin_size": "month", "field": "recording.connection_policy", "href": "/api/audit/sessions/histogram", "parent": "/api/audit/sessions", "remaining_seconds": 599, "time_zone": "Etc/UTC", "size": "10" } }
Element | Type | Description | ||
---|---|---|---|---|
body | Top-level element (string) | Contains the properties that are in the scope of the requested histogram. | ||
buckets | list | Contains the details of the histogram. | ||
active_count | integer | The number of sessions that were active in this interval. | ||
id | date | The starting date of the interval in ISO 8601 format. | ||
start_count | integer | The number of sessions that were started in this interval. | ||
meta | Top-level element (JSON object) | Contains metadata about the endpoint and the histogram. | ||
bin_size | string | The size of the intervals used to create the histogram. You can change this using the ?bin_size parameter of the request. Default value: month. Possible values: second, minute, hour, day, week, month, year | ||
field | string | Contains the name of the field that you requested statistics about. | ||
end | date | The date set in the ?end parameter of the request. By default, this is the date of the request. | ||
start | date | The date set in the ?start parameter of the request. By default, this is one month before the date of the request. | ||
time_zone | string | The time zone to use when calculating the intervals of the histogram, for example, Etc/UTC. By default, SPS uses UTC+0 (Zulu Time Zone). For the list of available time zones, see Element . | ||
size | integer | The size that you specified in your query. |
The following table lists the typical status and error codes for this request. For a complete list of error codes, see Application level error codes.
Code | Description | Notes |
---|---|---|
200 | OK | The query was well-formed and the histogram has been successfully retrieved. |
400 | TooMuchBucketsInResult | Using the requested bin_size would result in too many intervals for the queried period. |
400 | NotSupportedContentOption | This endpoint does not support filtering in the content of sessions. |
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center