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

API Error "Unknown controller"


#1

Hello,

I have a problem in one API method - “get_cases” (all other methods work well)

<Response [404]>
{“error”:“Unknown controller ‘suite_id’”}
[Finished in 0.4s]

And I am absolutely sure that suite with id “11” really exists.

Here is my python code:

import requests

url = “http://testrails.restr.im//index.php

querystring = {"/api/v2/get_cases/3":"",“suite_id”:“11”}

headers = {
‘authorization’: “Basic <here_my_hash>”,
‘cache-control’: “no-cache”,
‘content-type’:‘application/json’
}

response = requests.request(“GET”, url, headers=headers, params=querystring)
print response

print(response.text)


#2

Sorry:
of course after “Basic” I have my hash


#3

Hello Alena,

I would recommend using our official Python binding and you can then simply follow on our examples:

http://docs.gurock.com/testrail-api2/bindings-python

Looking at the error message, it seems that your URL is formatted incorrectly and get_cases would expect the following format, for example:

GET index.php?/api/v2/get_cases/:project_id&suite_id=:suite_id&section_id=:section_id

(suite_id and section_id are optional here)

I hope this helps!

Cheers,
Tobias