How to set up Postman (API Development Environment)?¶
Postman is a popular API development environment, that is, a tool that is used (among other useful features) to ease the interaction with API calls to remote sites. In this tutorial, we show the few steps necessary to set Postman to connect to the Open Data Hub datasets in both the mobility and tourism domains.
In the remainder of this tutorial, we will use as example the E-chargin station dataset, located at https://swagger.opendatahub.bz.it/?url=https://mobility.api.opendatahub.bz.it/v2/apispec#/Mobility%20V1%20-%20Emobility/ for the mobility domain and the Accommodation dataset, located at https://tourism.api.opendatahub.bz.it/#Accommodation.
After Postman has been launched, click on the New button, then on Request to start the configuration of the Open Data Hub endpoints, like shown in Figure 36.
In the dialog window that opens, write the URL of the endpoint in the Request name textfield and assign it in the ODH collection, see Figure Figure 37.
If no collection has already been created, create one by clicking on + Create collection, then write ODH and confirm.
Click onto start querying the endpoint.
Repeat the procedure for the Accommodation dataset and for any other dataset you want to query.
It is now possible to start querying the endpoints, by providing next to the GET button the corresponding call, like shown in Figure 38 for the E-charging station dataset and in Figure 38 for the Accommodation dataset. However, while the former images shows a set of results, on the latter appears the message Authorization has been denied for this request. and the status 401 Unauthorized.
The reason is that the data contained in that dataset have not (yet) been published as open data, therefore authentication is necessary. This is where Postman proves useful, since it can request authentication tokens (OAuth2 in the case of Open Data Hub), store them, and use them whenever the are needed.
By default, queries to the Open Data Hub return data in JSON format and postman does not need any setup for that. It is however possible, for some datasets in the Tourism domain–check Exporting and saving data section for the list, to have postman receive data in CSV. The required set up is shown in Figure 45: in the Header tab under the query, add a key Accept with value text/csv.