Session and Reporting
Session and Reporting¶
The API includes two endpoints that can be used to fetch Session and Usage data for certain Settings.
Important
While the impact on our systems is normal it’s nothing that should run for every setting on everyday basis, due to the number of requests/data.
- Endpoint
sessionsBySettings
returns the session count for a particular setting-id daily for a specific timeframe. The maximum timeframe allowed is 90 days.Should only be used when you are explicitly checking your session (e.g. in an overview). It's best if it's cached on a daily basis, since we only update the values once a day. Although the individual query isn’t very resource-intensive, it becomes so if a Partner runs it 10k times a day (due to 10k settings).
- Endpoint
totalSessionsForAllSettingsByTimeframe
returns the accumulated session count for all setting-ids across the specified timeframe. Maximum Timeframe 60 days.The use case for this endpoint is rather to do e.g. monthly reports/billing and as such should rather run on a Monthly/Weekly basis, but not every day.
Example Request
query {
TotalSessionsForAllSettingsByTimeframe(
from: "2022-01-01",
to: "2022-01-31"
) {
sessions,
settingsId
}
}
Example Response
{
"data": {
"totalSessionsForAllSettingsByTimeframe": [
{
"sessions": 12521,
"settingsId": "ABCDEF111"
},
{
"sessions": 195,
"settingsId": "ABCDEF222"
}
]
}
}
Common error messages and resolutions¶
Format is Authorization: Bearer [token] (Code: UNAUTHENTICATED)
Please check if you are sending the HTTP header authorization
in the format Bearer eyJhbGciO…
. This token can be retrieved using the authorization
endpoint described in this documentation.
Field \"x\" of type \"X\" must have a selection of subfields. Did you mean \"x { ... }\"?
In most cases, GraphQL requires you to specify the data you want to have returned from the API. This is also the case for mutation operations. Therefore you MUST specify at least one return value after the mutation parameters, e.g. mutation { setting(paramA: "123") {settingsId} }
You will also see this error when requesting a non-scalar data type (e.g. consentTemplates
in settings) and not defining any sub-parameter.
Field \"x\" argument \"y\" of type \"String!\" is required, but it was not provided.
If a GraphQL node supports arguments (e.g. setting()
) some of the arguments might be required
. You can identify required arguments in the playground documentation by an exclamation mark next to the type.