Want to use REST APIs to set comments on Test Cases

John June 20, 2019

I am using the https://docs.adaptavist.io/tm4j/server/api/v1/ APIs to automate create, update, and executions in our server based TM.  One thing that I don't see is the ability to add comments (i.e. 'Comments' tab in the Test Case UI) via the APIs.

I see, through browser debugging, that a different API is being called by the TM UI of '/rest/tests/1.0/testcase/<id>/comments'.   I am able to POST with that same API and add a comment.  The problem I am having is that the <id> is a numeric (ex: 1534). I don't know how to determine that value from the normal <projectKey>-nnn key beyond watching the network call when visiting the Comments tab.

Is the '/rest/tests/1.0/ API documented somewhere? If not, does anyone know how to determine this id? 

1 answer

0 votes
denisab85 October 1, 2020

You can get a test case ID (number) from your test case key (string like PROJ-T123) using this request:

GET /rest/tests/1.0/testcase/PROJ-T123

The response will contain the id value you need:

{
"testData" : [ ],
"majorVersion" : 1,
...
"id" : 12345,
"key" : "PROJ-T123",

...

}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events