Master How to execute Rest API call using Postman [ 2024 ]
How to execute Rest API call using Postman
A REST API call refers to a request made by a client (such as a web browser, mobile app, or server) to a REST API server to perform operations on a resource, typically over the HTTP.
In this tutorial, we will go through the steps to execute the REST API call using the Postman API tool.
Key Methods of REST API Calls:
REST APIs typically use standard HTTP methods to perform operations:
GET: Retrieve data from the server (e.g., fetch a list of users).
POST: Send data to the server (e.g., create a new user).
PUT: Update existing data on the server (e.g., update a user’s information).
DELETE: Delete data from the server (e.g., remove a user).
URL (Uniform Resource Locator): The URL is the address where the resource is located. The API call is made to this URL, which represents the resource you want to interact with.
Headers: These are metadata that can be included in the request, such as authentication tokens or content type. Headers provide additional information to the server about the request.
Body: For methods like POST or PUT, the body contains the data you want to send to the server, such as user information in JSON or XML format.
Response: The server will process the request and return a response, usually with a status code (e.g., 200 for success, 404 for not found) and sometimes data (e.g., the requested resource in JSON format).
Sample API call
Sample API call that we execute is :
GET http://<testlink_home>/lib/api/rest/v2/testprojects
This call returns the projects created in the TestLink Web application.
New to TestLink Rest API, please refer to the API guide:
Postman Tool
Chrome browser app
Steps to Execute REST API call using Postman
Launch the Postman API tool.
Add the Rest API endpoint using the box URL in the Postman tool.
Choose the method GET to execute the get method. Get requests do not need a request body.
In the Authorization tab, choose the Key as APIKEY and
Enter the value in the Value text box, as shown in the picture.
Click on the Send button to execute the API call.
Successful API call response status code should be 200 OK/ 201 created etc.
API call Response:
{ "status": "ok", "message": "ok", "item": [ { "id": "1", "notes": "<p>www.TestingDocs.com</p>", "color": "", "active": "1", "option_reqs": "0", "option_priority": "0", "option_automation": "0", "options": "O:8:\"stdClass\":4:{s:19:\"requirementsEnabled\";i:1;s:19: \"testPriorityEnabled\"; i:1;s:17:\"automationEnabled\";i:1;s:16:\"inventoryEnabled\";i:0;}", "prefix": "TDocs", "tc_counter": "0", "is_public": "1", "issue_tracker_enabled": "0", "code_tracker_enabled": "0", "reqmgr_integration_enabled": "0", "api_key": "7eb55806c7f7e8ccc83ce4b5b807c9866e5baba05430306f2525296d55db752b", "name": "TestingDocsProject", "effective_role": "8", "itname": null, "ittype": null, "rmsname": null, "rmstype": null, "opt": { "requirementsEnabled": 1, "testPriorityEnabled": 1, "automationEnabled": 1, "inventoryEnabled": 0 } } ] }
Verification
Log on to the TestLink Web application.
Check the test projects in the UI.
Test projects in the TestLink Web application.
More information on Postman:
- https://www.postman.com/