How to execute Rest API call using Postman [ 2024 ]
How to execute Rest API call using Postman
In this tutorial, we will go through the steps to execute the REST API call using the Postman API tool. 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
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:
Hello
I seem to keep getting 404 Not Found page even though I have followed every step.
I am running on Windows 10, Testlink on localhost, and using Postman.
A help would be greatly appreciated.
Thank you.
Hi Anncarel,
404 Not Found error indicates that the Testlink Rest API endpoints are not exposed on the Apache server.
Do the following configuration:
Enable Apache rewrite module.( https://www.testingdocs.com/testlink-rest-api-apache-server-configuration/ )
Check if you have .htaccess file with RewriteEngine On setting at :
\testlink\lib\api\rest\v2
Example: .htaccess file for v2 REST API call.
———————————————————–
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
——————
Hope this helps.