The Occupancy Prediction API : how to use it?

The Occupancy API is a REST API that relies on user authentification to provide detailed predicted occupancy information per line, direction, stop and time for a transport network.

Retrieving predicted occupancy and capacity requires two steps:

  1. Authentification
  2. Query of the API

1. Authentification

For authentification, please follow the instructions on this page.

2. Query of the Occupancy API

For Occupancy prediction query and response details, please check out this page.

It is recommended to query the API once per day, cache the result and filter on the client side for time and stop.

Indeed, predictions for a given day will not change during that day.

Full authentification and query sample

# Retrieve API token
login = <your email>
password = <your password>

login_response = GET("https://orleansmetropole.gateway.cit.io/api/login",
add_headers(Authorization = paste("Basic", base64_enc(paste0(login,":",password)))))

session_id = login_response$cookies$value[login_responsesponse$cookies$name=="sessionid"]

# Retrieve predicted occupancy
response = GET("https://orleansmetropole.api.cit.io/rest/predicted_occupancy?service_date=2021-04-07",set_cookies(sessionid = session_id))
predicted_occupancy = content(response)$data

Avez-vous trouvé ce que vous cherchiez ?

The Occupancy API : how does it work?

/api/login - Login

Contact