Skip to content

Pseudo-Service DiDok

The stops play an important role for many other queries. They can be taken from Didok (description) or from the station list (description).

Technical aspects

Using CKAN API enables you to initiate a simple search. Please note that you need to have an API key for this.

Sample query using DiDok

We are looking for “Domodossola” using an SQL query.

  • Identification of resource in “DiDok”:

https://api.opentransportdata.swiss/ckan-api/package_show?id=didok
{
    //...

    "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",
        //...
      }
    ]  
}
  • We will now search for Domodossola using the ID in the resource with the identifier “Didok.xlsx”.
https://api.opentransportdata.swiss/ckan-apin/datastore_search_sql?sql=SELECT * from "079e10fc-c212-4fc8-a75d-d02028f1539c" WHERE "Dst-Bezeichnung-offiziell" LIKE 'Domodossola'
  • The code which is currently valid for a resource must be inserted instead of “079e10fc-c212-4fc8-a75d-d02028f1539c”.
    {
      "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'"
      }
    }

    More detailed information