Postman is a powerful HTTP client for testing Webservices. Develop and document APIs by allowing users to put HTTP requests together.
Postman is available as a native app for Mac,Windows and Linux Operating Systems.
What is a well-constructed API?
· Does the service respond quickly enough for intended users?
· Will the server respond with correct values(Positive Testing)?
· How the service will handle exceptions and illegal values(Negative Testing)?
· Is the service stable under expected and unexpected use loads(JMETER,LoadRunner)?
Different types of HTTP Requests?
· GET – Retrieves data from specified resource.
· POST – Sends new data to a specified source.
· PATCH – Updates info for a specified source.
· DELETE – Removes data from a specified source.
The Anatomy of Request
Path Parameters
Variable parts of URL path point to specific resource within a collection. Out of ‘n’ number of issues it re routes you to the sub issues.
Query Parameters
It’s used to sort/filter the resources. Query parameters are used to sort with’? ‘It will drill out existing results.
Headers/cookies
Meta-data associated with API request and API response. We will send additional details to API process our results.
Security
Security will be handled by
Authentication and Authorization.
Authentication is basic credentials like username and password.
Authorization is user can have access to the data or not.
1. No Authorization
2. Basic Authorization(username, password)
3. API key
4. Digest Auth
5. OAuth
Variables
· Variables allow to reuse the values in multiple places so you cannot repeat the code.
· If we want to change the value ,We can change the variable once.
· Ex: if we want to set the environment variable for the URL.
https://reqres.in/ replaced by {{baseurl}} .Instead of entire URL we can replace by {{baseurl}}.
How to create a GET request?
Instead of sending full request you can replace with variable and send same request as
Error codes when you validating the response
· 1XX - Codes between (100-199) server is working on the request.
· 2XX – Codes between (200-299) means request was successful.
· 3XX- Codes between (300-399) means request was not performed.
· 4XX – Codes between (400-499) means that the request is complete.
· 5XX – Codes between (500-599) means that the server encountered a problem.
This the simple way to send a request and validate the response.