Authentification

Two means of accessing the API are available : Basic Auth and JWToken.

In both case, you will need a CITiO user account (login and password) that will be provided by CITiO.

Access Using BASIC auth

Access to all CITiO APIs is granted through "Basic" authentification with login (email) and password.

  • You need a CITiO user account (login and password) that will be provided by CITiO
  • You must send credentials to the login API that will respond with a token (session_id)

1. Set up the user session

Login and password must be encoded in base64 and added to the header of the GET query to the login route. See doc about our Login API

CITIO_CREDENTIALS=$(echo -n $CITIO_USER_NAME:$CITIO_PWD | base64)
curl --cookie-jar citio_cookies.txt -H "Authorization: Basic $CITIO_CREDENTIALS" https://${AGENCY_NAME}.gateway.cit.io/api/login

2. Use the session_id

Once you have retrieved a session_id, you must use it when querying any other API.

curl -b citio_cookies.txt https://${AGENCY_NAME}.api.cit.io/$API_ENDPOINT
curl -b citio_cookies.txt https://${AGENCY_NAME}.prediction.cit.io/$API_ENDPOINT

Access Using JWToken auth

1. Retrieve a token

To get a token, request the following endpoint:

https://$AGENCY_NAME.gateway.cit.io/api/token-auth with a POST request and the following body:

{
email: CITIO_USER_NAME,
password: CITIO_CREDENTIALS
}

2. Use the token to query the endpoint

Then query the API endpoint using the token in the header:

{"Authorization": "JWT $ACCESS_TOKEN"}

The token is short-lived and must be used within 5 minutes.

Go back to API main page.

Avez-vous trouvé ce que vous cherchiez ?

Occupany API - Sommaire

Contact