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

Accessing the TestRail API



I’m a little confused by how I’m supposed to access the TestRail API. I’m trying to take tests from Excel or CSV and automatically import them into TestRail. I know you can run a script to turn the files into XML and then manually import, but I want it done automatically.

From what I understand you have to send a HTTP request, but what I’m confused about is how to format all the information. Do I have to create a JSON object from the XML and send that object within the HTTP request?

Any help would be great. If this has been answered already, I’m sorry. I looked through a few hundred questions and haven’t found what I’m looking for.

Thank you,

Blaine Anderson


Hello Blaine,

Thanks for your posting. The TestRail API uses simple HTTP post requests. It returns all results in JSON format, and expects data to be sent via standard HTTP POST arguments (like a web form would send the data). So to create a test case, you would simply send the test case details as POST arguments:

title=New Test case

This needs to be encoded using url-form encoding as a normal form request would do, but most HTTP libraries do this automatically for you.

I hope this helps. Just let me know if you have any further questions about this.



So if I am creating a new test case, I would create arguments for each section? Something like:

title=new title
expected results= screen is on

and so on and so forth?

Since I’m using PHP, would I include those arguments as “POST Fields” when creating the http request with PHP?

Sorry for asking such basic questions, I’m just new to programming and PHP



I’ve just answered your other forum posting regarding the API issue and this hopefully clarifies how to access the API: