Download OpenAPI specification:Download
To call this API you need an API key provided by Seiki. The API key is provided in every HTTP call in the key header.
Here is an example in Python :
requests.get(
'https://api.winter-mushroom.seiki.co/v1/account/credits',
headers = {'key': MY_API_KEY}
)
In case of failed authentication, the API returns the following status codes :
To use this API, you need credits in order to create new POIs : 1 POI = 1 credit.
To retrieve your amount of credits, you can call the endpoint /account/credits
In case of insufficient credits, the API returns a status code 402.
For the endpoints that create POIs, the optional boolean parameter dry_run can be provided, which allows you to check authentication and parameters validity at no cost. It also allows you to retrieve what would be the cost of the computation.
Here's the workflow when you create POIs :
You can compute multiple POIs at once, using the asynchronous endpoint /poi/batch. When submitting your inputs, the API immediately returns a batch id. You can then query the API with this batch id, to check the batch processing state, and retrieve the output when done.
Here's an example submitting a new batch :
body = {
'items': [
{ 'lat': 48.8751, 'lng': 2.3074, 'end_date': '2023-12-03' },
]}
MY_BATCH_ID = requests.post(
'https://api.winter-mushroom.seiki.co/v1/poi/batch',
headers = { 'key': MY_API_KEY },
json = body
).json()['batch_id']
To retrieve the state and/or output of a batch, you can use the following code :
requests.get(
'https://api.winter-mushroom.seiki.co/v1/batch/' + MY_BATCH_ID,
headers = { 'key': MY_API_KEY }
)
To wait until a job is done, you can use the following code :
status_code = 202
while status_code == 202:
time.sleep(5) # Wait 5 seconds
output = requests.get(
'https://api.winter-mushroom.seiki.co/v1/batch/' + MY_BATCH_ID,
headers = { 'key': MY_API_KEY }
)
status_code = output.status_code
print(output.json())
This route allows you to check your remaining credits
requests.get( 'https://api.winter-mushroom.seiki.co/v1/account/credits', headers = { 'key': MY_API_KEY } )
{- "credits": 42
}This route allows you to compute a batch of new POIs, described by their coordinates or addresses. The route is asynchronous : it returns a batch id that can be queried subsequently. Beware that using addresses can result in imprecisions on the exact locations of the POIs.
Costs 1 credit per POI
| dry_run | boolean Default: false Perform a dry run : only checks authorization and parameters, at no credit cost |
Array of objects |
{- "items": [
- {
- "lat": 48.87,
- "lng": 2.3,
- "end_date": "2019-08-24"
}
]
}{- "consumed_credits": 1,
- "batch_id": "077d5c56-d25f-4d7f-a08e-24a935f55895"
}This route allows you to retrieve the state and output of a batch (if completed)
The status code can be used to check the job progression : 200 if done, 202 if still running
requests.get( 'https://api.winter-mushroom.seiki.co/v1/batch/MY_BATCH_ID', headers = {'key': MY_API_KEY} )
{- "state": "SUCCESS | FAILURE",
- "cost": 2,
- "refund": 1,
- "error": "string",
- "items": [
- {
- "lat": 48.87,
- "lng": 2.3,
- "start_date": "2019-08-24",
- "end_date": "2019-08-24",
- "error": null,
- "state": "SUCCESS",
- "data": {
- "traffic": {
- "daily_people": [
- 0.1
], - "mode_breakdown": {
- "property1": 0.1,
- "property2": 0.1
}, - "gender_breakdown": {
- "property1": 0.1,
- "property2": 0.1
}, - "age_breakdown": {
- "property1": 0.1,
- "property2": 0.1
}, - "social_group_breakdown": {
- "property1": 0.1,
- "property2": 0.1
}, - "trip_purpose_breakdown": {
- "property1": 0.1,
- "property2": 0.1
}
}, - "origins": [
- {
- "property1": 0.1,
- "property2": 0.1
}
]
}
}
]
}This route allows you to retrieve the list of all batches in the last 48 hours
requests.get( 'https://api.winter-mushroom.seiki.co/v1/batch', headers = {'key': MY_API_KEY} )
{- "items": [
- {
- "cost": 0,
- "creation_ts": "2019-08-24T14:15:22Z",
- "error": "string",
- "id": "string",
- "refund": 0,
- "state": "string",
- "update_ts": "2019-08-24T14:15:22Z"
}
]
}{- "items": [
- {
- "id": "15-24",
- "label": "15 à 24 ans"
}, - {
- "id": "25-34",
- "label": "25 à 34 ans"
}, - {
- "id": "35-49",
- "label": "35 à 49 ans"
}, - {
- "id": "50-64",
- "label": "50 à 64 ans"
}, - {
- "id": "65-PLUS",
- "label": "65 ans et +"
}
]
}{- "items": [
- {
- "id": "DOMICILE",
- "label": "Domicile"
}, - {
- "id": "TRAVAIL",
- "label": "Travail"
}, - {
- "id": "TOURISME",
- "label": "Tourisme"
}, - {
- "id": "ACHATS",
- "label": "Achats"
}, - {
- "id": "EDUCATION",
- "label": "Education"
}, - {
- "id": "SPORT_CULTURE_LOISIR_RELIGION",
- "label": "Sport, culture, loisirs, religion"
}, - {
- "id": "AUTRES",
- "label": "Autres"
}
]
}