affluence/affluences-api/API.md

83 lines
2.7 KiB
Markdown

# Affluences API Reference
## Terminology
* `site`
* General name for a location/institution
* Defined by a UUID and a slug, e.g. `ghent-university`
* Can contain one more or more sites, e.g.
`ghent-university-library-book-tower` is a child of `ghent-university`
## Notes
The API checks for browser user agents, so your requests should include a valid
user agent of a modern browser.
## API Routes
### Search for sites
`GET https://api.affluences.com/app/v3/sites`
**Body format**
```json
{
"selected_categories": [
1
],
"page": 0,
"search_query": "university of ghent"
}
```
**Response format**
`Data<Vec<SiteData>>`
### Retrieve time table for a given site
`GET https://reservation.affluences.com/api/sites/4737e57a-ee05-4f7b-901a-7bb541eeb297`
curl -L 'https://api.affluences.com/app/v3/sites/ghent-university' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0'
returnt lijst van alle bibliotheken op ugent, inclusief de uuids die dan nodig zijn om de specifieke requests te sturen naar die bib zijn stuff
curl -L 'https://api.affluences.com/app/v3/timetables/4737e57a-ee05-4f7b-901a-7bb541eeb297?offset=0' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0'
returnt de time table voor die bib
https://reservation.affluences.com/api/sites/4737e57a-ee05-4f7b-901a-7bb541eeb297
Basisinformatie voor s5 bib
https://reservation.affluences.com/api/resources/4737e57a-ee05-4f7b-901a-7bb541eeb297?type=1
returnt lijst van mogelijke lokalen voor s5
https://reservation.affluences.com/api/resources/4737e57a-ee05-4f7b-901a-7bb541eeb297/available?date=2023-05-11&type=1
returnt momenten die nog vrij zijn voor gegeven datum
pretty sure da die type 1 slaat op da et een bib is
https://api.affluences.com/app/v3/sites
body: {"selected_categories":[1],"page":0,"search_query":"university of ghent"}
zoek op alle mogelijke bibs, met een search query
Reservatie maken: posten naar url van deze vorm
98403 is de resource id van het lokaal, verkregen via de "available" call
https://reservation.affluences.com/api/reserve/98403
reservation request type
{"auth_type":null,"email":"dink.dink@ugent.be","date":"2023-05-11","start_time":"17:00","end_time":"18:00","note":"imagine","user_firstname":"dink","user_lastname":"dink","user_phone":null,"person_count":1}
reservation response success
{"reservation_id":33071685,"auth_token":null,"user_validation":true,"ticket_payload":null,"email":"dink.dink@ugent.be","success":"reservation_confirm_request_send","successMessage":"You are almost there… For your reservation to be effective, you must confirm it from the email we have just sent you. As a reminder, the email address you used is","cancellation_token":null}