Distinct Search in ODH Tourism api - noi-techpark/odh-docs GitHub Wiki
Endpoint:
https://api.tourism.testingmachine.eu/v1/Distinct (currently available on the Test instance, slow due to the DB on testing with little ressources)
Parameters
Required parameter
fields
--> (String) Pass one or more fields. The standard notation is used here Common parameters, fields, language, searchfilter, excludenulloremptyvalues, updatefromodhtype
--> (String) Pass the odhtype where the search should be done, the odhtypes are visible on https://tourism.api.opendatahub.bz.it/v1/MetaData or in the_Meta
Property of each Object. A valid odhtype should be passed otherwise the api returns an Error.
Known Generic ODH parameters:
fields
--> (String) odh fieldsfilter Dinstict over this selected fieldsrawfilter
--> (String) odh rawfilterrawsort
--> (String) odh rawsort, the only constraint here is that we have to sort on selected fieldsexcludenulloremptyvalues
--> (Boolean) remove empty and null values from output default: false
Examples
using on a simple string field
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=webcam&fields=Source
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=webcam&fields=_Meta.Source
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=odhactivitypoi&fields=Source
using on arrays
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=webcam&fields=PublishedOn.[]
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=odhactivitypoi&fields=HasLanguage.[]
using on arrays of objects (with array fields only one field is allowed) https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=odhactivitypoi&fields=Tags.[*].Id
Multiple Distinct fields (only with non-array fields)
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=webcam&fields=Source,OdhActive
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=odhactivitypoi&fields=Type,Source
Sorting
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=webcam&fields=Source&rawsort=Source
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=webcam&fields=Source&rawsort=-Source
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=odhactivitypoi&fields=Tags.[].Id&rawsort=Tags.[].Id
Multiple Sorting
https://api.tourism.testingmachine.eu/v1/Distinct?odhtype=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"
}
]
}