Using Postman to Test APIs

The free Postman GUI application allows you to test API requests and see examples before you add the API to your development environment. Postman files are provided in the Downloads / Developer Toolkits section of the online help for each set of APIs.

In this topic:

Credentials

The Travelport Postman collections for API versions previous to v11 include a separate environment file that must also be imported, per below.

You must send your request to the correct version of the API you are using - check the version in the URL of the endpoint, and make sure it matches the version indicated in your message headers.

Installing Postman

If you haven't already, download and install the appropriate version of the Postman app from https://www.getpostman.com/

Importing a Postman Collection

Take the following steps to load an API collection from Travelport. You can either import a collection from a link provided by Travelport, or download the collection to your local device and import the file from there.

  • In Postman, click the Import button on the black toolbar at the top of the screen.

  • If you are importing from a link, in the Import dialog box, click Import From Link, enter the link provided by Travelport, and click the Import button.

  • If you are importing a downloaded file, click Import File, click the Choose Files button, navigate to the file location, and click Open.

Postman displays the available samples in the collection in the left-hand panel. For the Air APIs, after importing a collection, you must set up an environment before you can run sample data.

Setting up an Environment

Environments provide credentials for use in testing, and allow you to customize your requests with variables.

You can either download the environment file provided as part of the developer toolkit (if that collection includes a separate environment file), or you can create an environment with these three variables:

  • Endpoint: The endpoint the suite will target.
  • PCC: The PCC you wish to search with.
  • Authorization: The authorization header.

Follow the directions below to add any environment file to Postman and to generate the authorization variable.

Adding an Environment to Postman

After creating an environment or downloading one from Travelport, take the following steps in Postman:

  • At the top-right of the Postman screen, click the small gear icon and select Manage Environments.

  • In the Manage Environments dialog, click the Import button.

  • Click the Choose Files button, navigate to the environment's file location, and click Open.

  • Close the Manage Environments dialog.

  • From the unlabeled dropdown next to the gear icon at the top-right of the screen, select the environment to use.

Generating an Authorization Variable

Take the following steps to generate the Authorization variable each time you run a request:

  • Select a request in the left-hand panel.

  • Select OAuth from the Type dropdown in the middle of the window. All services must use OAuth validation.

  • Fill in the username and password you need to use and click Update Request.
  • A new Authorization header is added to your request. Copy the value of that header and paste it into the value of the Authorization environment variable.

Running Test Searches in Postman

The panel on the right side of Postman has the Authorization, Headers, and Body tabs. Each Postman collection includes sample data and pre-formed requests, allowing you to test searches available in the collection. Select a search in the left-hand panel and click Send to load a sample response. Use the dropdown circled below to select JSON format. You can copy the JSON generated in Postman and paste it into your HTTP client with the appropriate header information to try it in your own application.

If the collection uses an environment file, remember to always select the appropriate environment file from the dropdown in the upper right-hand corner.

When copying Postman request data into your own application, you may want to substitute actual data for any variables in the test data. Otherwise, variables are pulled from the environment file.