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

TestRail API returned HTTP 403 ("You are not allowed to add test suites (insufficient permissions)


#1

Hi!

I’m trying to add test suite by means Python TestRail API but it returns 403 code. I have administration rights on TestRail so i’m a liitle bit confused.

Python script:

from testrail import *
import json

client = APIClient('testrail.example.com')
client.user = 'domain\username'
client.password = 'password'

project = '1'

json_data=open('./testsuite.json').read()
data = json.loads(json_data)

def add_testsuite(project_id):
    client.send_post('add_suite/' + project_id, data)

add_testsuite(project)

testsuite.json

 {
  "name": "This is a new test suite",
  "description": "Use the description to add additional context details"
 }

I got an error after trying to add testsuite:

testrail.APIError: TestRail API returned HTTP 403 ("You are not allowed to add test suites (insufficient permissions).")

TestRail v3.1.1.3130

Regards,
Alex


#2

Hi Alex,

Thanks for your posting! The administrator status is independent of the permissions and you can remove add-suite permissions even for TestRail administrators if you like. You can configure the permissions and role for your user under Administration > Users & Roles and your user account either has a global role without add-user permissions, or the project permissions are overridden for this user:

http://docs.gurock.com/testrail-userguide/howto-permissions

Cheers,
Tobias


#3

I can create test suites from from Web interface though and I have a designer role on the project.


#4

Hi Alex,

Thanks for the additional details! There was a small issue with the permission check with TestRail < 3.1.2 and the add_suite permission check was too strict. This is fixed with TestRail 3.1.2 and later and we recommend updating to a later TestRail version:

http://docs.gurock.com/testrail-admin/installation-upgrading

We are happy to help in case you have any questions about how to update TestRail.

Cheers,
Tobias


#5

Thank you for answer.


#6

You are welcome, Alex, and please let us know in case any further questions come up!

Cheers,
Tobias