Using Postman
Postman is a free cloud-based application that allows you to test API requests and see examples. Postman allows users to save API requests and examples into collections. Postman can store variable values for use in the URL, headers, and body of any request in a collection. You can use Postman to test APIs before deploying code to production.
Postman collections are included in the JSON API developer toolkits, available for download for the Air, Hotel, and Pay APIs. You can enter the credentials given to you at API provisioning to run through sample transactions.
In this topic:
Sign Up for Postman
If you aren't already using Postman, sign up for a free account at https://www.postman.com/. After a short series of questions, Postman creates a workspace for you.
Importing a Postman Collection
Take the following steps to import any of the JSON API Postman collections.
-
If you haven't already, download the Air DevKit, Hotel DevKit, Pay DevKit, unzip the file, and navigate to the Postman collection.
While the contents of developer toolkits vary, all DevKits include a Postman collection. The Postman collection file itself has a .json extension. Some toolkits also include OAS/Swagger files and example payloads, while others have examples embedded into the Postman collection.
-
In Postman, click the Import button at the top of your workspace.
-
In the dialog that opens, either drag the Postman collection file to the window or select it from the window. The imported collection appears in your workspace.
Using Postman
Entering Credentials and Generating Auth Token
See Authentication for details on entering your credentials and generating an authorization token.
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.
Navigating Postman
All JSON API Postman collections are organized in folders and sub-folders that follow the workflow for that set of APIs. API requests with extensive options have multiple folders to showcase possible paths. For example, the following JSON Air Postman collection includes examples of Flight Specific Search for one way and round trip options.
API collections without as many options have a flatter structure, as in this Exchange APIs collection:
Saved Examples in the Air Developer Toolkits
The Air API Postman collections include saved example responses, which allow you to browse code without entering credentials. The names of these saved examples are prefaced with e.g. instead of the HTTP method. These examples have already been run, and include matching requests and responses. In Postman, select the Body tab to see the request.
Some of the examples illustrate longer end-to-end flows that carry a specific scenario through all required API calls. In the example below, the first example highlighted with red is a standalone example, while the second highlight is part of an end-to-end (E2E) flow. This second scenario appears several times in this collection under the same example name.
End-to-end examples use the naming convention of E2E ExampleNumber.StepNumber.Description of flow. In the screenshot below, the second outlined example, E2E Example 1.2 Full Payload with FSLS is example 1, step 2, of the full payload with FSLS.
Running JSON Requests
Follow these steps to run any of the scripts in the Postman collections.
-
Click on any POST, GET, or DEL option (HTTP methods) to open a script for the API request. If desired, you can modify the request from the Headers and Body tabs. These scripts generate live pre-production responses from the API.
Notes:
-
To see the full code for JSON request click the Code icon </> below and to the right of the Send button.
-
For any variable used, you can look at the code to see the data passed to this request by that variable.
-
However, if the request body uses a variable that requires data from a previous API request that you haven't yet run, it remains a variable in the Code section until receiving the prerequisite data.
-
When copying Postman requests into your own application, you may want to substitute your data for variables in the scripts.
-
-
-
After making any desired modifications to the script, click the Send button to send the API request. The response appears in the panel below the request body.
-
You can save responses by clicking the Save as Example button at the top-right of the response. The ... button to the right of Save as Example allows you to save the response to a file.