Section 1: Introduction of Postman
What is Postman?
Postman - The Best API tool to develop and test (Manual/Automation) API/Webservices Tests with very minial code in quick and easy way.
Postman comes with powerful JavaScript editor which help us to perform various assertions inside the tool to vaildate Tests.
Postman offers various READY-MADE features of Framework like Variables, Enviroments, Workflows, Data Driven components and PM Object which helps to quickly Setup Automation lab for Testing.
As mention, Postman supports various types of Services like Restful API, Soup Web Services, GraphQL, etc.
Also Postman comes to powerful integration of Newman tool to run the Automated Tests from CLI which can alos be Intergrated with Jenkins for CI/CD Intergration.
Section 2: Installation and Startup
Installation
It's much easy to install the Postman, you can download the App from Postman offical website and double click to install it, Postman support MacOS and Windows. You can also work directly from the web browser. But the only the app got the best exprience,
Startup
Start the Postman, you can work and create your apis and test them without creating an account, you can skip it. But It's strongly recommend to create an account and start working beacuse you can explore a lot of opportunities, all kind of collaboration, sharing you code, putting comments on you code, everything you can do when you officially signed into Postman account.
Follow the steps input you email address and username password. Once you created an account and back to the app, you can see the blow welcome page.
So first of all, We need to create new workspace, the workspace just like a new project you create at IDEA, you can create lots of workspace and switched them whenever you want.
Just click the Workspaces button and click Create Workspace.
Postman gives four types of workspaces. You can choose a type depends on you situation。
After that we can create a collection.
Section 3: Send a Request and Get Response
After lanuch the Postman, the very first thing is "Create collection".
Collection in Postman is a group that related requests and making them easier to access and run, so that you can put your API requests into a collections of A Application.
Click "Add a request" then you will see the pad like this.
So that you can add all your api essential like URL, REQUEST METHOD, REQUEST BODY, HEADER and so on, after this you can click the "Send" buttong and get API RESPONSE bottom of Postman.
Now we gonna use Postman to test Postman API, enter the URL https://api.postman.com/workspaces
and click Send
button
Then we got the response and here it is giving some error which is expected a API key.
For create a API key, first we need to click the Settings and it will take us to the browser.
On the setting page, you can click Generate API Key and name you API Key
It would be better to copy your API Key
Back to the Postman. Add new KEY and VALUE to the HEADERS, the key is "x-api-key" and value are the API key we just copied.
Click "Send" button and we got the response
As we can see, there is no more error this time and the responset status are 200 OK, the response body list all the login account's workspace. So now we can understand that the API Key just like a token to show that who you are, then the backend server will send the data according who you are.