Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

...

Get the access token e.g. with OAuth2 Password grant. You may use the --insecure flag in case self-signed certificates are used:

Code Block
languagetext
$ curl \
  --request POST 'https://<sso-base-url>/uas/oauth2/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=password' \
  --data-urlencode 'scope=openid <accounting-client-id>' \
  --data-urlencode 'client_id=<oauth2-client-id>' \
  --data-urlencode 'client_secret=<oauth2-client-secret>' \
  --data-urlencode 'username=<accounting-api-user>' \
  --data-urlencode 'password=<accounting-api-password>'

...

Tip
titleSwagger API specification

The API specification for your installation is available in https://<accounting-base-url>/v2v3/api-docs

Authentication

Add the OAuth2 access token received from SSO like explained in Get access token to the Authorization header as a bearer token:

...

Parameter nameDescription
period

The period of the time from which to return the events: MINUTE, HOUR, DAY, WEEK (7 days), MONTH - case insensitive.

NOTE that you should choose such a period that produces a reasonable amount of events in the response so that you don't overuse resources. In typical installations, a period longer than a DAY is not recommended. It is better to make consecutive calls with a shorter period. See also spring.mvc.async.request-timeout property in Accounting Service additional configuration.

datetime

Optional date/timestamp for the earliest events to include with ascending order or latest events to include with descending order. The required precision for the parameter depends on the given period. If not given, derived from the current time and given period.

  • MINUTE 2021-03-19T08:23
  • HOUR 2021-03-19T08
  • DAY 2021-03-19
  • WEEK 2021-03-19 - meaning 7 days starting from /ending by the given day
  • MONTH 2021-03

The times are handled in UTC time zone so if you specify e.g. day/2021-03-31 with ascending order, then the events from 2021-03-31T00:00Z for 24 hours shall be included.

Query parameters

Parameter nameDescription
sortSort direction, provide '-' for descending order by timestamp, otherwise ascending order by timestamp is used.

...

Header nameDescription

Authorization

Mandatory bearer token e.g. 'Authorization: Bearer eyJjdHkiOiJKV1Q...' (token truncated)
Accept

Optional case insensitive media type for the response. If not provided or allows all media types, application/json media type is returned.

If CSV output is desired, media type text/csv needs to be specified. Note that due error handling in case of CSV it is recommended to add also application/json media type to the header with lower precedence as an error response is always JSON. You can use either the order or q-value to specify the precedence.

Examples:

'Accept: text/csv, application/json' - CSV is returned
'Accept: application/json;q=0.9, text/csv' - CSV is returned
'Accept: */*' - JSON is returned


Curl example

You may use the --insecure flag in case self-signed certificates are used. Add Accept header with value 'Accept: text/csv, application/json' for CSV output.

...

Response Document

JSON output

An EventDetailsResponse object with NavigationLinks and list of EventDetails matching request parameters is returned (see Swagger API models for additional information)

...

When accepting JSON media type and an error happens an ErrorResponse object is returned (see Swagger API models)

...

With JSON, if the streaming has already started with status code 200 and an error happens during processing, an error element may be included to the EventDetailsResponse.

With CSV, an error after streaming has started causes just end of streaming.

...