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

How to get_cases from TestRail API


#1

I’m getting 400 error when trying to access my project via API:
https://testrail.CompanyName.com/index.php?/api/v2/get_case/606218

Please advise


#2

Hello krthknan,

Thank you for posting! Receiving a 400 response with the get_case API method would indicate an invalid test case ID was used in the request. You would just need to be sure the appropriate test case ID is used in the API request. You can also find more information about this API endpoint on our website here:

http://docs.gurock.com/testrail-api2/reference-cases

If you are still unsure or are experiencing further issues with this, please reach out to the support team at contact@gurock.com and we’ll be happy to help.

Regards,
John


#3

I’m using valid test case ID, but still I’m experiencing the same issue.
Any other reason for this issue ?


#4

how is your actually code for calling this looks like ? Do you use the api adapters for this ?

the test case id is one thing, setting the right request etc, like content-type/authorisation etc etc


#5

Hello krthknan,

Thank you for the update! There is a slight difference between some of the available API methods. Some methods require a case_id while some require a test_id. A case_id is the ID of the parent test case in the test suite (the numbers following ‘C’ in the TestRail UI) while the test_id is the ID of the test inside the run (the numbers following ‘T’). If you are receiving a 400 response, the response should also contain some error message which would indicate the issue with the request. If you are getting an error regarding an invalid test case, it is possible you are passing the ID of the test and not the ID of the test case.

If you are still unsure or are experiencing further issues with this, please reach out to the support team at contact@gurock.com with the entire request/response pair and we are happy to help.

Regards,
John