What is Postman?
Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so we can create better APIs—faster.
Postman began as a REST client and has evolved into today’s comprehensive Postman API Platform.
Is Postman the Right Tool for Me?
Well that depends on whether you are a backend developer and want to test to operate some API testing, then mostly this will be the right tool for you and you can use it for security testing even if it isn't the primary focus of the tool.
But there are some cases when it won't be the right tool for you if you want to use it to:
- test handling the user interaction (pushing a button for example on a website)
- execute performance testing
APIs Documentation
Your mainly work will be using APIs so you should know how you can understand its documentation easily, and here are some tips:
1. Check the version
Code changes so make sure to always check the change notes and version information to figure out when and how issues with the code were addressed.
2. Use multiple sources
Reading the documentation on multiple sites also helps you discover which resources communicate in a way that works for you. Also reading about the same topic on multiple sites may fill in knowledge gaps that other coders may not have.
3. Review terms
Review key terms frequently when first starting out so you’ll be clear on what they mean when you run across them in the documentation (google is already your friend so make sure to search for the new terms 😉).
4. Be patient
Just like any other learning process, learning by reading documentation takes time. If you start to feel frustrated, take a break, and then come back to it with fresh eyes and a clearer brain.
Different Requests Types
The most common ones are: GET, POST, PUT, and DELETE, but there are several others.
GET
: It is normally used to only retrieve information from the system.POST
: It is designed to send loads of data to a server from a specified resource.PUT
: It is used to update resource available on the server.DELETE
: It is used to delete a specified resource.
For the next section we will use a public API made by "Valentin Despa" so try applying the APIs Documentation tips above on the APIs Document.*
Setting Up the Project
First, we create a new collection to collect all our APIs requests in one specific place as below
Query Parameters
Path Variables
Path variables,as the name indicates, refers to the variables that exist in the request path of the request to be able to change these variables with different value instead of writing them explicitly in the request as shown in the image below
Path variables have two types :
initial value
: You share it publicly (so don't put any password in this field)current value
: Only for private usages So we here made a collection specified variablebaseUrl
to use it instead of the fixed request pathhttps://simple-books-api.glitch.me
of the API service
You can create a new variable using the following steps:
When we want to use it we add {{
at the start and }}
at the end of the variable name (it will be{{baseUrl}}
in our case)
API Authentication
For some requests (POST
for example) the server will have to make sure that you are allowed to execute it, so here we have to register the client as in the image below in case of this API using the POST
request and the response will be an access token which is a private secret string (you mustn't share it with anyone) that you use to verify that you are allowed to be served by the server.
Note: you can create a collection variable for the access token for every time it is required to insert it instead of inserting it explicitly
Postman Console
It is specially designed to aid in debugging Postman collections and API calls.
Thank you and goodbye,