/kpis/ticketing/{filter_level}[/{filter_level_id}]/{aggregation_level}

The KPI API /ticketing endpoint returns number of in/out tickets aggregated by requested referential level and for requested referential element.

A session_id cookie is required to request CITiO APIs. To learn more about Authentification, use the documentation here.

Request

Base URL

https://{agency_name}.api.cit.io

Method

  • GET /kpis/ticketing/{filter_level}[/{filter_level_id}]/{aggregation_level}

Request syntax

# for a specified filter level id

Request Filter Level

When requesting KPIs, we must chose a filter level, that corresponds to a part of the network, defined in the Referential. We can then chose to filter on a specific element of that referential, by using its id, or to get the data for all of the elements.

Available filter levels for the Ticketing KPI are

  • agency
  • commune
  • line

Request Aggregation Level

When requesting KPIs, we must chose an aggregation level, that corresponds to a part of the network defined in the Referential. The data is aggregated by each element of that aggregation level.

Available aggregation levels for the Ticketing KPI are

  • for the whole agency
    • commune
    • line
    • station
    • ticket_type
  • filtered by commune
    • station
  • filtered by line
    • station
    • ticket_type

Request Parameters

All following parameters are used to filter the data returned by the API. At the exception of aggregated_by_time and aggregated_by_day, that respectively prevent the API to aggregate the response by day and by time.

Parameter

Value

Default

Comment

included_date_perimeters

Mandatory

Date Perimeters format

excluded_date_perimeters

Optional

Date Perimeters format

aggregated_by_{day/time}

Optional

true/false

false

can not both be true

ticket_type_id

Optional

{id}/all/null

all

we can select multiple ticket_type ids with {id}~{id}~{id}

purchase_source_id

Optional

{id}/all/null

all

direction

Optional

1/2/all/null

all

!= from boarding_direction (in/out)

connection

Optional

true/false/all

all

Response

A JSON-formatted object containing a list of ticketing data.

Response code

Response content

200

Json object

400

bad query message

failed query message

500

Back-end error response

JSON object
[
{
service_date, // except if aggregated_by_time=true
time, // except if aggregated_by_day=true
filter_level_id: int, // only if no filter_level_id in the request
aggregation_level_id: int
tickets_in: int,
tickets_out: int,
},
...
]
The API return only once each set of same values for service_date, time, filter_level_id and aggregation_level_id.
When data is aggregated by time, the time is always rounded to 15 minutes before.

Samples

Demonstrator

https://irigo_demonstrateur.api.cit.io/kpis/ticketing/agency/line?included_date_perimeters=2021-01-04_2021-01-06_1101100&aggregated_by_time=true

Sample request
https://test_network.api.cit.io/kpis/ticketing/line/2/ticket_type?included_date_perimeters=2021-01-04_2021-01-06_1101100&aggregated_by_day=true&purchase_source_id=8
Sample response content
[
{
"service_date": "2021-01-04",
"aggregation_level_id": 0,
"tickets_in": 56,
"tickets_out": 52,
},
{
"service_date": "2021-01-04",
"aggregation_level_id": 1,
"tickets_in": 5,
"tickets_out": 5,
},
{
"service_date": "2021-01-04",
"aggregation_level_id": 2,
"tickets_in": 48,
"tickets_out": 47,
},
{
"service_date": "2021-01-05",
"aggregation_level_id": 0,
"tickets_in": 53,
"tickets_out": 50,
},
{
"service_date": "2021-01-05",
"aggregation_level_id": 1,
"tickets_in": 6,
"tickets_out": 5,
},
{
"service_date": "2021-01-05",
"aggregation_level_id": 2,
"tickets_in": 45,
"tickets_out": 44,
},
]

Avez-vous trouvé ce que vous cherchiez ?

/api/login - Login

/rest/lines

Contact