Postman is a free app that allows you to make requests to API such as the Widgety API, without any coding required.
We have setup a 'collection' with all our requests pre-set and ready to use. Using Postman will allow you to explore the content available on our API in more depth than our Developer Website.
The collection is available to download through our Content website's Useful Resources section here.
- Step 1: Downloading the collection and installing Postman
- Step 2: Setting up the environment
- Step 3: Making requests
- Notes
Step 1: Downloading the collection and installing Postman
When you click on the button on the Useful Resources page, you will be prompted to install Postman should it not be installed on your computer.
Once this is done, click on the button again. This will ask whether you wish to add this collection to Postman. Say yes.
Step 2: Setting up the environment
The Environment is the information provided to Postman in regards to the endpoint of the API (the .json url), as well as your APP Key and Token. When stored in the environment, these will be applied to all the requests in the collection, without having to input them again.
When you first access the collection on Postman, no environment will be selected in the dropdown on the top right.
- In the dropdown, select 'My Widgety APP Key'
- Click on the eye icon next to it
- Click 'Edit' in the top right of the pop up
- In both the 'Initial Value' and 'Current Value' column, replace **MY APP ID** with your APP Key and **MY TOKEN** with your Token.
- Click on Update
Step 3: Making requests
All the requests available to make on the API are available in the 'Widgety API Cruise Requests' folder on the left-side of Postman. These have been split up between Cruises, Ship & Operators, and Ports requests.
To make a request, simply click on the request you wish to make and it will open as a tab in your window. You can then use any of the available filters in the 'Params' tab. Make sure that any filter you wish to use is checked on the left. This will indicate that Postman needs to include it in your request.
For example, this is a request for all cruises onboard P&O Cruises' Iona, with cruises sorted by departure date, for earliest to latest:
Notes
- Depending on your level of access, some requests may not work with your APP Key and Token.
- If you are using the Version 1 (deprecated) of our Cruises API, you will need to untick the 'Accept' row in the 'Headers' tab of each request. Otherwise an error will occur for every request you attempt to make.
- Any request with the word 'specific' in its name will require you to input a specific ref in the URL itself, instead of using a filter. For example, in the 'get_specific_cruise' request, you will need to edit the 'FREDL1908' ref provided as a sample with the ref of the cruise you wish to request. Refs can be found in the get_all_cruises request.
Comments
0 comments
Please sign in to leave a comment.