The term web API refers to several modules which can be integrated to a webpage to display web widgets featuring:
Example of an integrated API displaying the library's real-time occupancy
and opening hours (source: CHUV - BiUM)
These web APIs are composed of two main HTML tags which can be simply and quickly integrated on a webpage :
These snippets of HTML code can be retrieved from the API menu in the Affluences admin dashboard, under Administration.
Here is how a sample code to display the occupancy rate widget would look like.
- <html>
- <head>
- <script charset="UTF-8" src="https://webapi.affluences.com/js/webapi_latest.min.js%22></script>
- </head>
- <body>
- <div class="affluences-counter" data-token="TST0T0t0TT0TTT"></div>
- </body>
- </html>
WebAPIs can be customised by adding attributes in the <div> tag.
The table below summarises the different available attributes and their possible values.
WebAPI |
Attribute |
Possible values |
Description |
Opening hours |
|
true, false |
Enables to hide the lateral buttons which would help the user to go from one week to another |
|
whole numbers ranging from 1 to 7 |
Enables to display only a certain number of days in the week |
|
|
eng, deu |
Enables to change the language displayed (which is French by default) |
|
Real time occupancy or waiting time |
|
whole numbers ranging from 1 to 5 |
Enables to display the forecasts of the following time slots (1 to 5 slots possible) (see below) |
|
true, false |
Enables to switch to a grayscale display |
|
|
de, en, es, fr, it |
Enables to switch from French (by default) to another language |
|
|
character string |
Enables to change the mention displayed over the widget (by default, the name of the institution in the Affluences Admin dashboard). |
forecast-count
and data-title-override
attributes.