What is Postman?
Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs - faster. Once you have downloaded the API you can start to make requests against our API by reading our API Overview and by requesting an API Token
Postman is broken down into Workspace's - which you can think of as individual projects, then Collections which are essentially a way of grouping, finally, API requests.
In addition, Postman has the concept of Environments. Environments allow you, through the use of variables, to quickly and easily manipulate your requests based on the values assigned to your variables within the Environment. We'll cover more on Environments later in the article.
How can I start using Postman against the Infigo API?
Attached to this article is a Sample Postman Environment that you can download.
Once you have downloaded it, open your Postman app and click on the Import button (depending on your version of Postman this may be located and look slightly different.
Locate your downloaded Sample Postman Environment file and click Import.
You should see in the top right corner a dropdown and within there you should be able to select 'Sample'. Once you have selected 'Sample' click on the eye symbol next to it to view it.
The breakdown of the sample Environment you imported can now be seen in the popup. It should contain the following Variables, and what you can do in this popup is also enter in values for each of these variables:
- HostURL - This is the URL of your Infigo Storefront
- APIToken - This is the API Token you have obtained from the Support Desk
- CustomerGUID - This is a container to capture and store a Customer GUID value
- CustomerId - This is a container to store a sample Customer ID you have fetched from the admin in Infigo
- ProductId - This is a container to store the product ID of an Infigo product
- JobId - This is a container to store a Job ID
- OrderId - This is a container to store an Order ID
- EditorUrl - This is a container to store the Editor URL (if looking to follow the sequence of embedding our editor via an iframe in an external site)
Simply populate the environment variables with the values you want to test with each time and it will modify the requests to request and return the correct information.
We have created a number of Collections that are related to different aspects or features of our API that you will be able to download from the relevant Articles. These should all work with the environment you have downloaded from this article but to import them you simply click on the Import button (the same as you did for the Environment) select the Collection JSON file and click import.
Now you will see the Collection in the left hand panel and when you expand a Collection you will notice it is made up of a series (or collection) of API requests.
Running an API Request
All the action happens in the main centre console. Here you can decide if you want to make a POST or GET request (among others), configure any parameters, Authorization type, Input the body of the request and also create some tests which we cover later.
If you have imported one of or Collections then everything should be setup for you to just run it, once you have input your Environment variable values. If you are not using our Environment and want to just make some simple calls from scratch then that is also just as simple.
Lets take the Get Customer data API call as an example.
Authorization: Basic Auth (in the Username field paste in your Infigo API Token)
Body: This can be left blank as the information required to make this API call is all sent in the request URL.
You can optionally save the Request if you want to use it in a Collection later or just click Send.
If everything is configured correctly you should see in the Response section all the information returned for the customer on that storefront with the Id of 31847. Ours returned our lovely support team member Ben Mitchell's customer information.
This signifies a successful request and response. Unsuccessful requests should still contain useful information for you to understand why the response did not contain what you expected.
Using Postman Tests to manipulate your Environment variables
If you download our Collections, some may contain some Tests that will inspect the response of a particular request and then update an Environment variable.
This just helps chain multiple API calls together without having to manually modify values each time.
For example the Test above is used on the Get Customer data API call and takes the response JSON, looks for an entity called 'Guid' and then sets an Environment Variable called 'CustomerGUID' with the value.
In subsequent calls after this that require the CustomerGUID value it will already be populated and if you search for a different CustomerID it will then update the CustomerGUID for that customer when it is run.