Documentazione API

Dati geografici

Leggi i Geo-ID

Set di dati con l'albero geografico della Svizzera, con numero UST.

API: GeoTree/CH

Capitoli:

API: GeoTree/CH

Funzione

Produce l'albero geografico della Svizzera. Con Geo-ID e numero di comune dell'UST.

URL per le richieste

Per recuperare i dati, utilizzare il seguente URL. Si prega di prestare attenzione alle maiuscole e alle minuscole.

Parametri per le richieste

Con le seguenti variabili è possibile completare la query e controllare i risultati delle API.

Parametro Spiegazione Esempi
api_key
richiesto

La vostra chiave API

?api_key=abc-123-def-456
charset

La codifica desiderata della risposta

Varianti:
UTF-8 (= Standard)
ISO-8859-1

&charset=iso-8859-1
format

Il formato di uscita desiderato

Varianti:
JSON (= Standard)
XML
CSV

&format=xml
hl

Lingua desiderata dell'uscita

Varianti:
de = Tedesco (= Standard)
fr = Francese
it = Italiano
en = Inglese

&hl=en

Valori di ritorno dell'API

Il contenuto delle risposte API deriva da:
- i dati che hai sottoscritto (paesi, vacanze, vacanze scolastiche, anni solari)
- i dati ufficialmente noti dei legislatori
- la disponibilità in base alle nostre ricerche (situazione effettiva del nostro database)

Si prega di notare che l'output in formato CSV è diverso.

Array         Spiegazione Esempio
interface         Versione dell'API  
source: href       URL della fonte dei dati (sito web)  
  description       Nome della fonte dei dati  
copyright href       URL al titolare del copyright (sito web)  
  description       Designazione del titolare del diritto d'autore  
apiName         Identificazione dell'API GeoTree/CH
apiStatus description       Designazione dello stato API. Per le varianti, vedere i Messaggi di errore active
date         Data di esportazione dei dati 27.04.2024
request: iso       Codice ISO del paese, 2 cifre CH
  charset       Codifica dei caratteri di output utf-8
  format       Formato dei dati di uscita json
  hl       Lingua di emissione, secondo la richiesta it
results status description     Stato dell'output. Per le varianti, vedere i Messaggi di errore ok
  location       Unità geografica secondo la richiesta  
    description     Nome dell'unità geografica Svizzera
    type     Designazione del tipo di unità geografica Paese
    geoId     Geo-ID dell'unità geografica. 3056
    iso     Codice ISO del paese, 2 cifre CH
    iso-3166-2     Codice regione secondo ISO 3166-2  
    bfs     Numero comunità UFS (disponibile solo a livello di comunità) NULL
    children     Eventuali unità geografiche subordinate  
      description   Nome dell'unità geografica Argovia
      type   Designazione del tipo di unità geografica Cantone
      geoId   Geo-ID dell'unità geografica. 1
      iso   Codice ISO del paese, 2 cifre CH
      iso-3166-2   Codice regione secondo ISO 3166-2 CH-AG
      bfs   Numero comunità UFS (disponibile solo a livello di comunità)  
      children   Eventuali unità geografiche subordinate
(1-3 livelli, a seconda del cantone)
array

Messaggi di errore

Posizione di uscita Messaggio di errore Spiegazione
apiStatus
apiStatus: description invalid usage L'uso di questa API non è sbloccato per voi.
Si prega di contattare il nostro supporto.
apiStatus: description invalid key Chiave API non valida.
Si prega di controllare la chiave API.
apiStatus: description invalid referer Accesso non valido. Non sono ammessi link da pagine web (front-end).
Impostate la vostra richiesta in modo che provenga da un back-end protetto.
Se necessario, contattare il nostro supporto.
apiStatus: description inactive L'API non è ancora stata abilitata all'uso.
Si prega di riprovare in un secondo momento.
apiStatus: description expired Il periodo di utilizzo secondo il contratto è scaduto.
Contattate la nostra amministrazione per un prolungamento del contratto.

Esempi

JSON

URL:
https://feiertagskalender.ch/api/GeoTree/CH/?api_key=YOUR_API_KEY

Risposta delle API:

{
   "interface":"fcal API 2.01",
   "source":{
      "href":"https://feiertagskalender.ch",
      "description":"feiertagskalender.ch"
   
},
   "copyright":{
      "href":"https://psc.ch",
      "description":"psc Peter Schuetz Informatik-Dienstleistungen, CH Bern"
   
},
   "apiName":"GeoTree/CH",
   "apiStatus":{
      "description":"active"
   
},
   "date":"2020-04-03",
   "request":{
      "iso":"CH",
      "charset":"utf-8",
      "format":"json",
      "hl":"de"
   
},
   "results":{
      "status":{
         "description":"ok"      
},
      "location":{
         "description":"Schweiz",
         "type":"Land",
         "geoId":"3056",
         "iso":"CH",
         "iso-3166-2":"",
         "bfs":null,
         "children":[
            {
               "description":"Aargau",
               "type":"Kanton",
               "geoId":"1",
               "iso":"CH",
               "iso-3166-2":"CH-AG",
               "bfs":null,
               "children":[
                  {
                     "description":"Aarau",
                     "type":"Bezirk",
                     "geoId":"2",
                     "iso":"CH",
                     "iso-3166-2":"CH-AG",
                     "bfs":null,
                     "children":[
                        {
                           "description":"Aarau",
                           "type":"Gemeinde",
                           "geoId":"3",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4001",
                           "children":null
                        },
                        {
                           "description":"Biberstein",
                           "type":"Gemeinde",
                           "geoId":"4",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4002",
                           "children":null
                        },
                        {
                           "description":"Buchs (AG)",
                           "type":"Gemeinde",
                           "geoId":"5",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4003",
                           "children":null
                        },
                        {
                           "description":"Densb\u00fcren",
                           "type":"Gemeinde",
                           "geoId":"6",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4004",
                           "children":null
                        },
                        {
                           "description":"Erlinsbach (AG)",
                           "type":"Gemeinde",
                           "geoId":"7",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4005",
                           "children":null
                        },
                        {
                           "description":"Gr\u00e4nichen",
                           "type":"Gemeinde",
                           "geoId":"8",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4006",
                           "children":null
                        },
                        {
                           "description":"Hirschthal",
                           "type":"Gemeinde",
                           "geoId":"9",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4007",
                           "children":null
                        },
                        {
                           "description":"K\u00fcttigen",
                           "type":"Gemeinde",
                           "geoId":"10",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4008",
                           "children":null
                        },
                        {
                           "description":"Muhen",
                           "type":"Gemeinde",
                           "geoId":"11",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4009",
                           "children":null
                        },
                        {
                           "description":"Oberentfelden",
                           "type":"Gemeinde",
                           "geoId":"12",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4010",
                           "children":null
                        },
                        {
                           "description":"Suhr",
                           "type":"Gemeinde",
                           "geoId":"14",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4012",
                           "children":null
                        },
                        {
                           "description":"Unterentfelden",
                           "type":"Gemeinde",
                           "geoId":"15",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4013",
                           "children":null
                        }
                     ]
                  },
                  {
                     "description":"Baden",
                     "type":"Bezirk",
                     "geoId":"16",
                     "iso":"CH",
                     "iso-3166-2":"CH-AG",
                     "bfs":null,
                     "children":[
                        {
                           "description":"Baden",
                           "type":"Gemeinde",
                           "geoId":"17",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4021",
                           "children":null
                        },
                        {
                           "description":"Bellikon",
                           "type":"Gemeinde",
                           "geoId":"18",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4022",
                           "children":null
                        },
                        {
                           "description":"Bergdietikon",
                           "type":"Gemeinde",
                           "geoId":"19",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4023",
                           "children":null
                        }
                     ]
                  }
               ]
            }
         ]
      }
   }
}

XML

URL:
https://feiertagskalender.ch/api/GeoTree/CH/?api_key=YOUR_API_KEY&format=xml

Risposta delle API:

<fcal_api>
<interface>fcal API 2.01</interface>
<source>
    <href>https://feiertagskalender.ch</href>
    <description>feiertagskalender.ch</description>
</source>
<copyright>
    <href>https://psc.ch</href>
    <description>psc Peter Schuetz Informatik-Dienstleistungen, CH Bern</description>
</copyright>
<apiStatus>
    <description>active</description>
</apiStatus>
<apiName>GeoTree/CH</apiName>
<date>2020-04-03</date>
<request>
    <iso>CH</iso>
    <charset>utf-8</charset>
    <format>xml</format>
    <hl>de</hl>
</request>
<results>
    <status>
        <description>ok</description>
    </status>
    <location>
        <description>Schweiz</description>
        <type>Land</type>
        <geoId>3056</geoId>
        <iso>CH</iso>
        <iso-3166-2/>
        <bfs/>
        <children>
            <child>
                <description>Aargau</description>
                <type>Kanton</type>
                <geoId>1</geoId>
                <iso>CH</iso>
                <iso-3166-2>CH-AG</iso-3166-2>
                <bfs/>
                <children>
                    <child>
                        <description>Aarau</description>
                        <type>Bezirk</type>
                        <geoId>2</geoId>
                        <iso>CH</iso>
                        <iso-3166-2>CH-AG</iso-3166-2>
                        <bfs/>
                        <children>
                            <child>
                                <description>Aarau</description>
                                <type>Gemeinde</type>
                                <geoId>3</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4001</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Biberstein</description>
                                <type>Gemeinde</type>
                                <geoId>4</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4002</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Buchs (AG)</description>
                                <type>Gemeinde</type>
                                <geoId>5</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4003</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Densbüren</description>
                                <type>Gemeinde</type>
                                <geoId>6</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4004</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Erlinsbach (AG)</description>
                                <type>Gemeinde</type>
                                <geoId>7</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4005</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Gränichen</description>
                                <type>Gemeinde</type>
                                <geoId>8</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4006</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Hirschthal</description>
                                <type>Gemeinde</type>
                                <geoId>9</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4007</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Küttigen</description>
                                <type>Gemeinde</type>
                                <geoId>10</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4008</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Muhen</description>
                                <type>Gemeinde</type>
                                <geoId>11</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4009</bfs>
                                <children/>
                            </child>
                                <child>
                                <description>Oberentfelden</description>
                                <type>Gemeinde</type>
                                <geoId>12</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4010</bfs>
                                <children/>
                                </child>
                            <child>
                                <description>Suhr</description>
                                <type>Gemeinde</type>
                                <geoId>14</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4012</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Unterentfelden</description>
                                <type>Gemeinde</type>
                                <geoId>15</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4013</bfs>
                                <children/>
                            </child>
                        </children>
                    </child>
                    <child>
                        <description>Baden</description>
                        <type>Bezirk</type>
                        <geoId>16</geoId>
                        <iso>CH</iso>
                        <iso-3166-2>CH-AG</iso-3166-2>
                        <bfs/>
                        <children>
                            <child>
                                <description>Baden</description>
                                <type>Gemeinde</type>
                                <geoId>17</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4021</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Bellikon</description>
                                <type>Gemeinde</type>
                                <geoId>18</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4022</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Bergdietikon</description>
                                <type>Gemeinde</type>
                                <geoId>19</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4023</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Birmenstorf (AG)</description>
                                <type>Gemeinde</type>
                                <geoId>20</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4024</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Ehrendingen</description>
                                <type>Gemeinde</type>
                                <geoId>31</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4049</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Ennetbaden</description>
                                <type>Gemeinde</type>
                                <geoId>21</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4026</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Fislisbach</description>
                                <type>Gemeinde</type>
                                <geoId>22</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4027</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Freienwil</description>
                                <type>Gemeinde</type>
                                <geoId>23</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4028</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Gebenstorf</description>
                                <type>Gemeinde</type>
                                <geoId>24</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4029</bfs>
                            <children/>
                            </child>
                            <child>
                                <description>Killwangen</description>
                                <type>Gemeinde</type>
                                <geoId>25</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4030</bfs>
                                <children/>
                            </child>
                        </children>
                    </child>
                </children>
            </child>
        </children>
    </location>
</results>
</fcal_api>                  

CSV

Aufruf:
https://feiertagskalender.ch/api/GeoTree/CH/?api_key=YOUR_API_KEY&format=CSV

Risposta delle API:

location_L0;type_L0;iso;geoId_L0;iso-3166-2;location_L1;type_L1;geoId_L1;location_L2;type_L2;geoId_L2;location_L3;type_L3;geoId_L3;bfs
Schweiz;Land;CH;3056;;;;;;;;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;;;;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Aarau;Gemeinde;3;4001
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Biberstein;Gemeinde;4;4002
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Buchs (AG);Gemeinde;5;4003
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Densbüren;Gemeinde;6;4004
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Erlinsbach (AG);Gemeinde;7;4005
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Gränichen;Gemeinde;8;4006
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Hirschthal;Gemeinde;9;4007
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Küttigen;Gemeinde;10;4008
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Muhen;Gemeinde;11;4009
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Oberentfelden;Gemeinde;12;4010
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Suhr;Gemeinde;14;4012
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Unterentfelden;Gemeinde;15;4013
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Baden;Gemeinde;17;4021
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Bellikon;Gemeinde;18;4022
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Bergdietikon;Gemeinde;19;4023
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Birmenstorf (AG);Gemeinde;20;4024
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Ehrendingen;Gemeinde;31;4049
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Ennetbaden;Gemeinde;21;4026
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Fislisbach;Gemeinde;22;4027
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Freienwil;Gemeinde;23;4028
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Gebenstorf;Gemeinde;24;4029
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Killwangen;Gemeinde;25;4030
                
Pagine
Progetti partner
©2003 - 2024 psc Peter Schütz Informatik Dienstleistungen, CH-Bern