Push data to Publisher - noi-techpark/opendatahub-docs GitHub Wiki
Push Data to Publisher
Often data has to be repushed to a Publisher.
The Importer Api offers a Method for this Task. However the User needs the right Permissions to perform this.
The route to push data is a POST Method
https://tourism.importer.opendatahub.com/CustomDataPush/{type}/{publisher}
type
As type we can pass a valid Open Data Hub Content Api Type see here Type
publisher
And a valid Publisher has to be added
https://tourism.api.opendatahub.com/v1/Distinct?type=publisher&fields=Id&getasarray=true
Filling the Ids as Body
The Idlist has to be added in the POST Body as Json
Format:
[ "id1","id2","id3" ]
Then a response is generated which contains (for each Id)
- notificationId the generated Notification Id by the Publishers Api
- httpStatusCode
- service Publisher Id
- success Boolan Success true/false
- objectId The Id of the Pushed Object
Example:
"response": {
"response": {
"notificationId": "eabcdefg-xyz"
},
"httpStatusCode": 201,
"service": "suedtirolwein",
"success": true,
"objectId": "smgpoid4dbc5ef61914fb5906e2f1135290eab"
}
Concrete Example
First let's get a Idlist we want to push by using the Api. We want to push all odhactivitypois
with OdhTag xy
assigned activated for the publisher publisher
So we make a GET Call to this route:
https://tourism.api.opendatahub.com/v1/ODHActivityPoi?odhtagfilter=xy&fields=Id&publishedon=publisher&pagesize=0&getasidarray=true
We pass pagesize = 0 because we want to have all data matching this filter and the fields filter to only get the Id.
We pass getasidarray=true
to have a idlist which we can use on the POST Endpoint
Then we get a result like
[
"id1","id2","id3"
]
We can Pass this directly as Body in Postman
We get a complete Result with all Informations inside.
Additional Information
The service surely can take long time if we push hundreds of Ids, so it is better to split up the Id list in reasonable chunks to avoid HTTP Timeouts.