Introducing Postman for API Testing
Postman is a free and easy to use GUI application that makes testing APIs quick and simple.
To get started with Postman
- Visit the Postman website to download and install the Postman Desktop Client.
- Once Postman has installed and launched it will ask you to sign up for a free account. Signing up for a free account is recommended as it gives you access to the full features that Postman provides and it enables you to carry your library of tests around with you, but it is not required in order to use Postman.
Using Postman to make API calls
To start with a simple new API call in Postman, under Start with something new, click Create New
That will take the user into to the Postman workspace area with the following modal window presented to them. Click on HTTP Request.
This will start a new untitled HTTP request, where the user can begin composing API calls to a REST API service such as the Spire API.
Please take note of the following Locations in Request Area (upper area) in the above image which we will refer to later on:
- HTTP Verb [GET]
- Request URL
- Send Button
- Authorization Tab
- Body Tab
Sending an OPTIONS Request
An OPTIONS request will reveal which HTTP Verbs are valid for any given API Endpoint. If you don’t know which HTTP Verbs you can use with any Spire API, send an OPTIONS request to it, and Spire will respond with a list of the Verbs that it can respond to.
In the following example we will be looking at the OPTIONS response from the Sales Order Collection endpoint.
- Set the HTTP Verb to be OPTIONS
- Provide the Sales Order Collection API endpoint URL
- Authorization Tab -> Ensure Type is set to Basic Auth
- Enter valid Spire credentials in the Credentials section
- Click Send
In the response area, click to view the Headers tab to see the data that was returned by Spire. An OPTIONS request will only contain header data. The HTTP Verbs which the API endpoint supports will be listed as the value in the Allow header field.
In this case we can see that the Sales Order Collection accepts HEAD, GET, OPTIONS, and POST requests.