Postman is one of the best development tools used to test, modify, and also build APIs(application programming interface). All the APIs and schemas are supported in postman. Postman application is free to download and also it is easy to start. Using postman you can make any kind of API call like RESt, SOAP or plain HTTP easily and can even inspect the largest responses.
For data formats like OpenAPI GraphQL, and RAML postman provides some built-in support too. In this blog, we are going to discuss how to configure Postman for sending requests.
You can directly install the postman from https://www.getpostman.com/postman. Open the postman after the installation.
Creating and Sending Request
You can use postman in case you are building or testing the API that you have created or also in case if you are integrating with a third-party API. Using postman you can send parameters, authorization details, and also any body data as per your requirements.
To create a new request go to New -> Request, or click the + button.
You can specify the details for your request in the following tab.
If you need to run a request you need to specify the URL, method and other parameters like auth. You can set the endpoint URL to the postman echo sample api endpoint and specify the method and send the request by clicking on the button Send. Each URL that you set in the postman represents the API endpoint. As we know each endpoint in an API is available at a specific URL, and this is what we are setting in the postman. In case of third party API they will be providing the URL , for example it will be available in their API documentation itself. Or suppose you are using your custom API the URL will be the location plus the path you have given.
In postman we can make requests to APIs. Each API request uses an HTTP method. The most commonly used methods are as follows:
* GET - This method is used to retrieve data from an API.
* POST - It is used to send new data to an API.
* PATCH and PUT - These methods are used to update the existing data.
* DELETE - This one is used for removing data.
Postman also uses a number of other methods and you can also use any custom methods too. You can also set the parameters and any body data which is required to send the API request. And suppose if you don’t need any parameters or authentication you can directly click on the Send and can fetch the corresponding responses.
Parameters can be sent using the tab params. Query parameters are appended to the end of the request URL following the ? and the key value pairs which are separated by the &. To add parameters to the URL you can add directly to the request URL or open the params tab and there you can enter the name of the parameter and also the corresponding value associated with it.
Sending Body Data
Along with the requests we may need to send the body data in case we need to add or update the structured data. Using the Body tab you can send the body data you need to send with the request. You can also choose various types of body data according to the API that you are using.
* For sending files you can use form data. For that you can use the form-data Body tab.
* URL- encoded data uses the same encoding as URL parameters. x-www-form-urlencoded in the Body tab can be used in case you are using url encoded data.
Some APIs require auth details. Authentication involves verifying the identity of the client sending a request, and authorization involves verifying that the client has permission to carry out the endpoint operation. Open the Authorization tab to configure your access details.
Once you have set up the API request you can see the corresponding responses also.