Skip to content

Distinct Search in ODH Tourism api

RudiThoeni edited this page Nov 28, 2024 · 17 revisions

Endpoint:

https://tourism.api.opendatahub.com/v1/Distinct (currently available on the Test instance, slow due to the DB on testing with little ressources)

Parameters

Required parameter

Known Generic ODH parameters:

  • fields --> (String) odh fieldsfilter Dinstict over this selected fields
  • rawfilter --> (String) odh rawfilter
  • rawsort --> (String) odh rawsort, the only constraint here is that we have to sort on selected fields
  • excludenulloremptyvalues --> (Boolean) remove empty and null values from output default: false

Examples

using on a simple string field
https://tourism.api.opendatahub.com/v1/Distinct?type=webcam&fields=Source
https://tourism.api.opendatahub.com/v1/Distinct?type=webcam&fields=_Meta.Source
https://tourism.api.opendatahub.com/v1/Distinct?type=odhactivitypoi&fields=Source

using on arrays
https://tourism.api.opendatahub.com/v1/Distinct?type=webcam&fields=PublishedOn.[*]
https://tourism.api.opendatahub.com/v1/Distinct?type=odhactivitypoi&fields=HasLanguage.[*]

using on arrays of objects (with array fields only one field is allowed)
https://tourism.api.opendatahub.com/v1/Distinct?type=odhactivitypoi&fields=Tags.[*].Id

Multiple Distinct fields (only with non-array fields)
https://tourism.api.opendatahub.com/v1/Distinct?type=webcam&fields=Source,OdhActive
https://tourism.api.opendatahub.com/v1/Distinct?type=odhactivitypoi&fields=Type,Source

Sorting
https://tourism.api.opendatahub.com/v1/Distinct?type=webcam&fields=Source&rawsort=Source
https://tourism.api.opendatahub.com/v1/Distinct?type=webcam&fields=Source&rawsort=-Source
https://tourism.api.opendatahub.com/v1/Distinct?type=odhactivitypoi&fields=Tags.[*].Id&rawsort=Tags.[*].Id

Multiple Sorting
https://tourism.api.opendatahub.com/v1/Distinct?type=odhactivitypoi&fields=Source,SyncSourceInterface&rawsort=Source,-SyncSourceInterface

result

[
{
"PublishedOn.[*]": "idm-marketplace"
},
{
"PublishedOn.[*]": "suedtirol.info"
}
]

paged result By adding pagenumber=1 the result is available paged and wrapped into the standard Result object.

{
"TotalResults": 2,
"TotalPages": 1,
"CurrentPage": 1,
"PreviousPage": null,
"NextPage": null,
"Seed": null,
"Items": [
{
"PublishedOn.[*]": "idm-marketplace"
},
{
"PublishedOn.[*]": "suedtirol.info"
}
]
}

Get As Array Parameter

By Adding the parameter getasarray=true the result is added into an Array without fieldnames.
Example Response

[
"noicommunitycategory",
"eventlocation",
"cuisinecodes",
"idmredactionalcategory",
"ltscategory",
"eventtopic",
"seattype",
"technologyfields",
"dishcodes",
"customtagging",
"categorycodes",
]
Clone this wiki locally