Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I set Owner of a Test Case on Jira Software Server using a REST API Client?

Edited

I've recently set up a Jira Software Server and created test cases using REST API automation.

I need to set the Owner inside of the test cases but with no avail. The following

error message was the result:

{
"errorMessages": [ "The user _ was not found for field owner."]
}

 

1 answer

0 votes
Dario B Atlassian Team Jul 24, 2020

Hello @sthumulati ,

I believe this question was mistakenly created under the Jira Automation section, while I believe it is about the TM4J - Test Management for Jira add-on:

 

Therefore I have moved it to the Marketplace Apps and Integrations section. I have also added the proper tag so that there are higher chances to get a reply form TM4J team.

 

However, looking at the error message, it looks like you are trying to set the user '_' as the owner for your test case and this user was not found.

Can you kindly let us know which value are you passing in order to set the owner?

 

Cheers,
Dario

Hi,

    I have a project lead name Ashwin Thumulati.

I am unable to set the owner to the default lead. 

So, the error message is actually...

{
"errorMessages": [ "The user Ashwin Thumulati was not found for field owner."]
}

 

RestAssured Output:

Request method: POST
Request URI: http://localhost:8080/rest/atm/1.0/testcase
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Headers: Authorization=Basic c3RodW11bGF0aTpQb2x5IW1hdGg0MjA=
Accept=application/json, text/plain, */**
Accept-Encodng=gzip, deflate
Content-Type=application/json
Cookies: <none>
Multiparts: <none>
Body:
{
"projectKey": "DT",
"name": "DT-103",
"objective": "Testing Jira REST API",
"precondition": "Planned Test",
"folder": "/Prototype",
"status": "Approved",
"priority": "Low",
"component": "Prototype",
"owner": "_",
"estimatedTime": 26602284,
"labels": [
"UI",
"API"
],
"issueLinks": [
"DT-1"
],
"customFields": {
"Misc": "Etc"
},
"testScript": {
"type": "STEP_BY_STEP",
"steps": [
{
"description": "description",
"testData": "testData",
"expectedResult": "expectedResult"
}
]
}
}
{
"errorMessages": [
"The user Ashwin Thumulati was not found for field owner."
]
}

Is there Jira Software Server setting I could use to activate reader Owner?

Dario B Atlassian Team Aug 05, 2020

Hi @sthumulati , 

Before going any further, can you confirm the username is "_" and that the user has proper rights to be assigned as the owner? 

You can check this by sending a GET request to the below endpoint:

http://localhost:8080/jira/rest/api/2/user?username=_

 

If this does not help then I would advise to get in touch with the vendor by using the resources listed in the support tab of the marketplace page for the app:

Contact

 

Cheers,
Dario

Request method: GET
Request URI: http://localhost:8080/rest/api/2/user?username=sthumulati
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Headers: Authorization=Basic c3RodW11bGF0aTpQb2x5IW1hdGg0MjA=
Accept=application/json, text/plain, */**
Accept-Encodng=gzip, deflate
Content-Type=application/json
Cookies: <none>
Multiparts: <none>
Body: <none>
{
"self": "http://localhost:8080/rest/api/2/user?username=sthumulati",
"key": "JIRAUSER10000",
"name": "sthumulati",
"emailAddress": "sthumulati@gmail.com",
"avatarUrls": {
"48x48": "http://localhost:8080/secure/useravatar?avatarId=10349",
"24x24": "http://localhost:8080/secure/useravatar?size=small&avatarId=10349",
"16x16": "http://localhost:8080/secure/useravatar?size=xsmall&avatarId=10349",
"32x32": "http://localhost:8080/secure/useravatar?size=medium&avatarId=10349"
},
"displayName": "Ashwin Thumulati",
"active": true,
"deleted": false,
"timeZone": "America/Chicago",
"locale": "en_US",
"groups": {
"size": 2,
"items": [

]
},
"applicationRoles": {
"size": 1,
"items": [

]
},
"expand": "groups,applicationRoles"
}

Hi Dario,

           I ran the GET call and above is the result. 

But I'm unable to interpret. Please reply. Thanks.

 

-Ashwin Thumulati

        

Dario B Atlassian Team Aug 14, 2020

Hello @sthumulati ,

In the example you provided earlier, you were trying to set the owner of the test to the user _ 

"owner": "_",

 

Now you are providing the details of the user sthumulati:

Request URI: http://localhost:8080/rest/api/2/user?username=sthumulati

 

So, I am not 100% sure I understand what you are doing here, but:

  1. Make sure your user have proper rights (for example, try to set the test owner to your user from the UI).
  2. If you are able to set the owner from the UI, try again using REST API calls but setting the owner to 'sthumulati'
  3. If nothing works, please get in touch with the app vendor as already suggested in my previous reply

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

685 views 7 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you