
The article today will share with you about How to make API request. When working with APIs, we only work with 2 main types of APIs: GET and POST.
– GET: Ask the server to return resources: Imagine the scene on fb, swiping new feeds.
– POST: Ask the server to create a new resource. For example, register for a ride at GrabBike.
And a request consists of 4 components:
1. URL
2. Method
3. Headers
4. Body
When entering the real project, where do you get the above information, from the developer. To test the API, you must have API documents. This depends on the company, there will be its own standards and samples, but in general, the following information must be provided: API name, purpose of use, Method, URL, params, Sample Request, Sample Response.
The article today will share with you about How to make API request. Let check it out
Table of Contents
Create GET request
I would like to use the sample API provided by Postman.

1. URL: https://echo.getpostman.com/get (Update: https://postman-echo.com)
2. Method: GET
3. Headers: No need to fill in anything
4. Body: The GET method does not have a body, you must enter parameters in the Params

Note: All Params passed must be correct, do not leave a space or a line break.
After filling in all the information, press SEND to send the request and wait for the response to return.

The returned information will have several points of interest:
1. Return data format: usually json and should be in Pretty mode for easy viewing.
2. Data Content: This is the part you have to check.
– You compare with the Sample Response in the API docs to see if the return structure is correct or not.
– Value of each key is correct, compare with the content in the DB. (Without DB, you can’t do API testing, of course when you do API auto test, you can’t compare with DB).
3. API status (status) and return time:
Please note, the API run time with Postman is always shorter than the test time on the Mobile interface for many reasons: the internet connection at the computer is more stable than Wifi, and after receiving the response, the Mobile has to run the code to initiate the transaction. area to display.
Create POST request
Similar to the above, just enter the parameters in the body.

And so is the response part

Thank you for reading.
To see more articles about API testing , please go this link