Site icon TestingDocs.com

How to fix 400 Bad request error in TestLink API

Overview

In this tutorial, we will look at a sample issue and fix 400 Bad request errors in executing the TestLink REST API request.

Error

Let’s take an example API call:

/testlink/lib/api/rest/v2/superman

This call is used to check the REST API is working on the TestLink Server instance.

Apache Access Log

Apache access log entry would be something similar to:

“GET /testlink/lib/api/rest/v2/superman HTTP/1.1” 400 326 “-” “PostmanRuntime/7.26.1”

 

To view the access log we can use the following command:

Go to the directory path of the Apache access log.

Issue the following command:

$ tail -f access.log

We need to take the clue from the Response body which says ‘authentication error’. Ideally, standard Rest API endpoints respond with 401 Unauthorized response code fro authentication problems.

Fix

Check the API key that you have provided as an HTTP header. It should match exactly with the key that you have generated on the TestLink server instance. (https://www.testingdocs.com/testlink-api/)

 

Exit mobile version