Quick and (not-so) Dirty Tips for Tourism

This section contains various tips and tricks to improve and tweak the queries sent to the Tourism datasets, allowing more precise results to be retrieved. This page is divided into two parts: The first one shows examples with code (usually the API call), the second is organised like a FAQ section..

Example Calls

EX1. Why does this query return no result?

http://tourism.opendatahub.bz.it/api/Gastronomy?pagesize=3&categorycodefilter=0&locfilter=reg268

Because there is no value reg268 for locfilter. You can return valid IDs to be used as locfilter using this call:

http://tourism.opendatahub.bz.it/api/RegionReduced?language=it

An example result for this call is:

{
  "Id": "D2633A26C24E11D18F1B006097B8970B",
  "Name": "Alta Badia"
},

Therefore, use the ID regD2633A26C24E11D18F1B006097B8970B in locfilter to search for Gastronomy in the Alta Badia region.


EX2. The locfilter parameter.

Q: How do I correctly use the locfilter parameter?

locfilter =>
Locfilter (Separator ',' possible values: reg + REGIONID = (Filter by
Region), reg + REGIONID = (Filter by Region), tvs + TOURISMVEREINID =
(Filter by Tourismverein), mun + MUNICIPALITYID = (Filter by
Municipality), fra + FRACTIONID = (Filter by Fraction)),
(default:'null')

It seems to accept a string, but how is this string built?

A: locfilter accepts a string composed as follows: a region identifier, followed immediately by a location Identifier.

Location identifier are the following four:

  • reg: Region (Italian Regione)
  • tvs: Turistic association (German Tourismusverein)
  • com: Town or city (Italian Comune)
  • fra: Suburb or district (Italian frazione)

IDs for each location can be gathered either from the swagger interface or using an API calls:

  • reg:

    http://tourism.opendatahub.bz.it/swagger/ui/index#!/Common/Common_GetRegionsReduced
    http://tourism.opendatahub.bz.it/api/RegionReduced?language=it
    
  • tvs:

    http://tourism.opendatahub.bz.it/swagger/ui/index#!/Common/Common_GetTourismvereinReduced
    http://tourism.opendatahub.bz.it/api/TourismAssociationReduced?language=iturismusverein)
    
  • com:

    http://tourism.opendatahub.bz.it/swagger/ui/index#!/Common/Common_GetMunicipalityReduced
    http://tourism.opendatahub.bz.it/api/MunicipalityReduced?language=it
    
  • fra:

    http://tourism.opendatahub.bz.it/swagger/ui/index#!/Common/Common_GetDistrictReduced
    http://tourism.opendatahub.bz.it/api/DistrictReduced?language=it
    

For example, to retrieve all Gastronomy in the suburb of Lana, first retrieve its ID, which is:

{
  "Id": "79CBD79551C911D18F1400A02427D15E",
  "Name": "Lana"
},

Then pass the string fra79CBD79551C911D18F1400A02427D15E as locfilter:

http://tourism.opendatahub.bz.it/api/Gastronomy?locfilter=fra79CBD79551C911D18F1400A02427D15E

EX3. The categorycodefilter parameter.

Q: categorycodefilter seems similar to the locfilter parameter found in this trick, but this does not accept string?

Category Code Filter (BITMASK values: 1 = (Restaurant), 2 = (Bar /
Café / Bistro), 4 = (Pub / Disco), 8 = (Apres Ski), 16 =
(Jausenstation), 32 = (Pizzeria), 64 = (Bäuerlicher Schankbetrieb),
128 = (Buschenschank), 256 = (Hofschank), 512 = (Törggele Lokale),
1024 = (Schnellimbiss), 2048 = (Mensa), 4096 = (Vinothek /Weinhaus /
Taverne), 8192 = (Eisdiele), 16348 = (Gasthaus), 32768 = (Gasthof),
65536 = (Braugarten), 131072 = (Schutzhütte), 262144 = (Alm), 524288 =
(Skihütte)

The categorycodefilter parameter accepts integers instead of strings. The code of each category is a power of 2, so to search in multiple categories, simply add the respective codes and pass them as value of the parameter. For example, to search for Restaurants (1) and Pizzerias (32), pass 33 to categorycodefilter:

http://tourism.opendatahub.bz.it/api/Gastronomy?categorycodefilter=33

Tips and Tricks

TT1. Categorycodefilter in the Accomodation dataset.

Q: In the Accommodation dataset there’s no categorycodefilter filter, like in the Gastronomy dataset. Is there some equivalent filter?

A: Accommodations belong to a different dataset, use categoryfilter and the


TT2. odhactive and fields starting with odh.

Q: What is the purpose of the odhactive field? And what are all the parameters prefixed with odh stand for?

A: odh simply stands for Open Data Hub. There are fields like active and odhactive. Datasets filtered with the former return all data sent and validated by the dataset provider, while the latter returns those validated by the Open Data Hub team as well.

TT3. The seed field

Q: What is the seed field used for?

A: seed is used in pagination, i.e., when there are two or more pages of results, to keep the same sorting in all pages. By passing to the API call the null string, no seed is generated and there is no sorting; by passing 0, a seed is generated and will be used in pages from 2 onwards; By passing a predefined seed, it will be applied to all result sets.