Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to send the accountId for the reporter field. But it says that user as null.

Rakesh July 11, 2024

 

"reporter": {"id": "712020:50163ca5-c07e-4a15-a400-14aa37f48cee"}, "priority": {"name": "Medium"} }} 2024-07-11 12:34:02 - Failed to create ticket. Status: 500. Response: {"message":"Cannot invoke \"com.atlassian.jira.user.ApplicationUser.getUsername()\" because \"user\" is null","status-code":500,"stack-trace":""}

1 answer

0 votes
Jehan Bhathena
Community Champion
July 11, 2024

Hi @Rakesh 

What API are you trying to call? And is this the complete Json body that you're passing?

From the looks of it I'd recommend checking if the user has permissions to create a ticket or can be set as the reporter, would also check if the user who is setting the User Assignee (user whose token is used) has the Assign Issue permission too

Rakesh July 11, 2024

I am using this url to fetch the user details.
url: "https://example.atlassian.net/rest/api/3/user/search?query=example@gmail.com".

The user is there in the project and have the permissions that you have mentioned.

And about json, for now i hard coded the accountId for the reporter field.But  i am getting this error:{"message":"Cannot invoke \"com.atlassian.jira.user.ApplicationUser.getUsername()\" because \"user\" is null","status-code":500,"stack-trace":""}

 
Jehan Bhathena
Community Champion
July 11, 2024

Hi @Rakesh 

Thanks for the info, can you mention for which API you get the 500 error? Or What's the steps that you've used to reproduce this error.

 

Rakesh July 11, 2024

@Jehan Bhathena 

I am using this url for fetching the user details,

https://example.atlassian.net/rest/api/3/user/search?query=example@gmail.com

But i am getting the empty response, like i am not getting data of that user in jsonarray.

And also can you specify the value that i need to pass for reporter?

 

fields.put("reporter", new JSONObject().put("id", reporterAccountId));. this is not full code. but i send the jsonobject as data for creating ticket in jira software.
Jehan Bhathena
Community Champion
July 11, 2024

Hi @Rakesh 

For the User search api, your api is correct. Does your User have access to the user administration though, since without that permission it may not be feasible to get an results.

About the fields.put() don't have much insights into that.

Rakesh July 11, 2024

@Jehan Bhathena 

Actually I am the project Admin and i am trying to give my accountId as value for reporter field.And i am doing that by using the code. I will tell the process,
First i need to fetch the user details by using the gmail.
second i will fetch the accountId from that details and pass it as value for the reporter field.

How can i check this "Does your User have access to the user administration though"? and

is accountId should be passed for reporter field right?

 

Jehan Bhathena
Community Champion
July 11, 2024

Use Control + K on your keyboard and search for 'Global Permissions', if you have access to this that means you have Jira Admin access.

Check for the "Browse users and group", this permission needs to be available for the users to be searchable.

After this to verify your access, click on the cog icon and see the options listed there, if you see Administration settings and the User Administration settings, then u have site administration access (feel free to share the image here if you require assistance for this)

Rakesh July 11, 2024

 

 

@Jehan Bhathena 

Thank You for the Help!
The Issue is solved.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events