Example using Postman¶
In this example we first make a POST
request, using Postman, to aquire a Bearer token and then we use the token to request statistics.
Getting a token¶
The information needed is all in open+ access. Go to the Configuration tab, select the customer and the select the API tab.
Here you will find the client id
and the client secret
.
Now we can go to Postman and make a request to the open+ Identity Server, which will return the token.
Create a new
POST
request tohttps://identity.opnbibliotheca.com/connect/token
Under Headers tab create key-value pair.
Content-Type: application/x-www-form-urlencoded
Under Body tab create 4 key-value pairs.
client_id : "your client id" client_secret : "your secret" grant_type : client_credentials scope : OpenPlusAPI
Now click Send to make the request and receive the token.
Now we can use the token to get statistics.
Getting statistics¶
With the token it is now possible to make requests to the API.
Create a new
GET
request tohttps://api.opnbibliotheca.com/v1/peoplecount
Under the Authentication tab create a key-value pair. The value is “Bearer” + whitespace + the token.
Authentication: Bearer "token"
Now click send to receive statistics. The statistics will look like below.
More queries¶
Here are some example of queries.
To get raw data: https://api.opnbibliotheca.com/v1/peoplecount
To get aggregated data: https://api.opnbibliotheca.com/v1/peoplecount?aggregation=day
To get paginated data: https://api.opnbibliotheca.com/v1/peoplecount?limit=5
Pagination. When using pagination or when result is larger than 1MB, you receive a startToken in the request. The startToken should be included in the next query to continue getting the next results and so on.
It will look like this.
https://api.opnbibliotheca.com/v1/peoplecount?limit=5
The starttoken you receive should be included in the next query like this, where xxx is the starttoken you received in the previous query.
https://api.opnbibliotheca.com/v1/peoplecount?limit=5&starttoken=xxx