In this tutorial you will learn how to import OpenAPI Specs of PTV Developer into Postman to quickly test the capabilities of the different services.
Preconditions
- A Postman account (this tutorial works with the desktop client as well as the web frontend of Postman but uses screenshots from the desktop client)
- A PTV Developer account and API Key
Workspace
To create a new Workspace open Postman and use the workspace ribbon on the top left. In this case it is named "PTV Developer".
Collection
To create a collection we will directly import an OpenAPI specification file by using the import button next to the workspace name on the top left. This example uses the Geocoding and Places Open API specification file which can be found in the API Reference page of the documentation by clicking on the Download API Specification button.
In the import window change to the link tab and insert the link to the Open API specification file.
In the next window leave the settings as they are and click Import.
Now the Geocoding collection should be visible in the collection view of Postman.
Authorization
To send first requests it is now necessary to authorize against the services using the API Key from the API Keys App. Copy your API Key and insert it in Postman using the Autorization tab of the imported collection as seen in the screenshot below.
You can choose to either use the API key as a query parameter or insert it to the request header. This tutorial uses the query parameter.
Note that you have to save the changes by using the save button on the top right (highlighted in red).
Send requests
Now its time to set up a first request. This tutorial uses the search locations by text function which is a free-form input geocoding function using a single address string.
To receive the coordinates of the Empire State Building in New York City set the searchText parameter to the according address "350 5th Avenue, New York City, NY 10118". If the country of an address is known it is beneficial to use the countryFilter attribute to gain performance. Details about the parameters can be found in the API Reference page.
Now everyhting is set and you can send the request and see the response in the response box at the bottom.
Congratulations.
You are now able to send requests to the PTV Developer APIs using Postman. Note that the steps of this tutorial can also be used for any other API of PTV Developer and are not limited to the Geocoding and Places API.
Developer Collections
For some PTV Developer APIs we provide specific Postman collections. The included sample requests are easily to modify according to your needs. The big advantage of these collections is that the result will be visualized like a route or reachable area displayed on a map or the optimized bins arranged on a loading space.
The available Postman collections can be downloaded from GitHub.
To use these collections first import the environment (developer_postman_environment.json) to Postman. Then change the API Key placeholder to your API Key and apply the environment in the top right corner.
Import the API collection of your choice in the same way the environment was imported. The collection is immediately ready to use. In case of sending a request, you will find the visualization of the result on the 'Visualize' tab in Postman.