The easiest way of structuring and reusing different test in Postman is to switch from ‘History’ to ‘Collection’ which can be found in the left side of the Postman GUI. One advantage is that configuration like authentication can be inherit and not configured for each test.
Creating the Collections
The initial steps are as follows:
Create the ‘config’, ‘jobserver’ and ‘portserver’ collections
Click on the ‘New collection’ – Encircled in blue – and follow the wizard / guide
Specify the name
Select the ‘Authorization’ tab
Select ‘Basic Auth’
Specify the user and password
Click ‘Create’
Creating a simple Get request
Move the mouse pointe / cursor to the create ‘config’ collection and the ‘…’ appears – here highlighted in blue
Click and select ‘Add Request’
Name the request ‘/api/config/shiplist/’
Add ‘Get all shiplists’ as description
Select ‘Save to config’
Duple click or right click and select ‘Open in new tap’ on the created request
Enter ‘HOSTNAME/api/config/shiplist/’ as request URL – where the HOSTNAME must be changed to either the system DNS name or the system IP which is the same as when you use aisweb
Ensure that the type is ‘GET’
Ensure that Authorization is to ‘Inherit from Parent’
Click Save
Click Send
The result:
Creating a POST request / Area report
Click on ‘jobserver’
Click on ‘…’
Click and select ‘Add Request’
Name the request ‘/api/jobserver/stat/area’
Add ‘Start an Area report of all ships in an area’ as description
Select ‘Save to jobserver’
Duple click on the create request
Change the type to ‘POST’
Type ‘HOSTNAME/api/jobserver/stat/area’ – where the HOSTNAME must be changed to either the system DNS name or the system IP which is the same as when you use aisweb
Ensure that Authorization is to ‘Inherit from Parent’
Click on ‘Body’
Click on ‘raw’
Click on type which is set to ‘Test’ and change the type to ‘JSON (application/json)’
Enter / copy and paste the following as body payload