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

Add_Case Web Api Question



I am trying to add a simple test case using the web api. I really just want to be able to add the testcase under a particular section with just a title. When I try to add the test case with just the following json: {“title”:“Test1”}, I get custom_type is a required field. I cannot find information about this field in the api documentation so I’m not sure what it is. I also tried adding the test case with a node module called node-testrail and the request still fails with the same error. When I run the node module the json is:


Can anyone help me figure out how to make this request work with the least amount of required data? I know you can make a testcase with just a title in the web application so I would assume it should be possible through the web api as well.



Thanks for your posting. The only required property for add_case by default is title and adding a case with just the title works with a default TestRail installation. The custom_type field is a custom field of your TestRail installation added by one of your TestRail administrators in the past. The field is also set to required for the project you are testing this with and the add_case API calls fails for this reason.

So, you have two options here. You can either include a value for the custom_type field as part of the add_case call. Or you/an administrator can change the custom field to non-mandatory as part of the custom field options under Administration > Customizations in TestRail.

I hope this helps!



Oh okay thanks for the help. Is there anyway to check what data is required? I found that the custom_type is associated with test types. Basically I’m not sure how I can format my json content so that its accepted. I will also check with my admins.


I figured this out! It was just a custom type that was setup in our staging environment that needed to be removed. Thanks for the help.


Ah okay, makes sense! You can find the full list of custom fields under Administration > Customizations in TestRail but good to hear that it works now.