Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

POST request, 400 Bad Request Error - Content-Type header invalid


I am in the process of migrating a Testrail client to Testrail 3. I am following the migration guide and attempting to use JSON to send the requests. However, I am running into errors when using the add_run API method.

I am running this in RESTclient to debug.

The request I send is POST index.php?/api/v2/add_run/1
(I have a project with id 1)

As request headers I am using Content-Type: application/json and Authorization: Basic USERNAME:PASSWORD_BASE64

request body is:

{ "name":"name", "suite_id":1 }

Upon sending the request, I receive a “400 Bad Request” Response with the error message:

Since I am in fact using Content-Type: application/json as a request header I have no idea why I am getting this error or what it means. Any ideas?



Thanks for your posting. Could you let me know which tool do you use to submit the request? Ideally, you would post the entire request example here (without the user/password, of course).