Les arrêts sont importants pour de nombreuses autres requêtes. Ceux-ci peuvent être obtenus à partir de Didok (description).
Aspects techniques
Avec l’API CKAN, il est possible de mettre en place une recherche simple. Notez que vous avez besoin d’une clé API pour cela.
Exemple de requête Didok
A partir de Didok, nous recherchons “Domodossola” à l’aide d’une requête SQL.
- Identification de la ressource dans “Didok”:
1https://api.opentransportdata.swiss/ckan-api/package_show?id=didok
12345678910111213141516171819{//..."resources": [{"url_type": "upload","cache_last_updated": null,"issued": "2016-11-08T12:59:39.053524","package_id": "f26dee75-1ed0-4c07-ac19-c98249e94bc5","relations": "[]","datastore_active": true,"id": "079e10fc-c212-4fc8-a75d-d02028f1539c",//..."identifier": "Didok.xlsx",//...}]}
- A l’aide de l’ID dans la ressource avec l’identifiant “Didok.xlsx”, nous recherchons maintenant Domodossola
1https://api.opentransportdata.swiss/ckan-api/datastore_search_sql?sql=SELECT * from "079e10fc-c212-4fc8-a75d-d02028f1539c" WHERE "Dst-Bezeichnung-offiziell" LIKE 'Domodossola'
Au lieu de “079e10fc-c212-4fc8-a75d-d02028f1539c”, il faut insérer le code actuellement valable pour une ressource.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798{"help": "https:\/\/opentransportdata.swiss\/api\/3\/action\/help_show?name=datastore_search_sql","success": true,"result": {"records": [{"Dst-Bezeichung-offiziell": "Domodossola","GO-Nr": "11","GO-Abk": "FFS","VD": "","VPP": "*","KOORDY": "666.299999999999954525264911353588104248046875","KOORDX": "107.4500000000000028421709430404007434844970703125","Dst-Nr.": "1607","_full_text": "'1':6 '107.4500000000000028421709430404007434844970703125':8 '11':1 '1607':5 '270':3 '666.299999999999954525264911353588104248046875':9 '9998':7 'domodossola':10 'ffs':4","Dst-Abk": "DO","VPG": "","BP": "*","KZ": "1","_id": 6602,"Dst-Bezeichnung lang": "","Gde-Nr": "9998","KOORDZ": "270"}],"fields": [{"type": "int4","id": "_id"},{"type": "tsvector","id": "_full_text"},{"type": "numeric","id": "Dst-Nr."},{"type": "numeric","id": "KZ"},{"type": "text","id": "Dst-Bezeichung-offiziell"},{"type": "text","id": "Dst-Bezeichnung lang"},{"type": "text","id": "Dst-Abk"},{"type": "numeric","id": "GO-Nr"},{"type": "text","id": "GO-Abk"},{"type": "numeric","id": "Gde-Nr"},{"type": "text","id": "BP"},{"type": "text","id": "VPP"},{"type": "text","id": "VPG"},{"type": "text","id": "VD"},{"type": "numeric","id": "KOORDY"},{"type": "numeric","id": "KOORDX"},{"type": "numeric","id": "KOORDZ"}],"sql": "SELECT * from \"079e10fc-c212-4fc8-a75d-d02028f1539c\" WHERE \"Dst-Bezeichung-offiziell\" LIKE 'Domodossola'"}}