Create an issue with rest api set reporter name

Matias Costa Meneses November 17, 2020

Hi community, im trying to create an issue with rest api, im receving error 400 (bad request)

the problem is when i try to set another reporter. I have seen that you can add a reporter name, but it doesnt work for me. If i remove the section of reporter it works fine, but i need to change the reporter.

this is my code

fields: {
project: {
id: "10000"
},

reporter: {

name: "mcosta"
},
summary: "testAccJira",
description: "descripcion del issue ",
issuetype: {
id: "10001"
}
}
}

 

the e-mail that im registered is mcosta@....com.uy

my name is Matias Costa Meneses

I had trying putting my name, my mail, the left part of my email, and nothing work...  what is the username? where i get it?

 

thanks!!

2 answers

1 accepted

3 votes
Answer accepted
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 17, 2020

Hi @Matias Costa Meneses,

based on your information, you mentioned that you're using a Cloud instance.

Atlassian has disabled user names on Cloud instances, therefore you're not able anymore to set a reporter via a name. You should use an accountId instead. The accountId is the unique identifier of your Atlassian account. In order to find it out, you can e.g. call this url https://YOURINSTANCE.atlassian.net/rest/api/2/myself (while you're logged in to your Atlassian account). The response will look like this:

{
"self": "https://YOURINSTANCE.atlassian.net/rest/api/2/user?accountId=1234567890",
"accountId": "1234567890",
...
}

Using this accountId, you should be able to create your issue with such a request:

{ 
fields: {
  project: {
    id: "10000"
},
reporter: {
accountId: "1234567890"
},
summary: "testAccJira",
description: "descripcion del issue ",
issuetype: {
id: "10001"
}
}
}

Hope that helped!

Cheers,
Matthias

Matias Costa Meneses November 18, 2020

Thank you very much for the answer, could you tell me if there is any way to change the reporter using the email address?

Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 18, 2020

You can do another rest call before which resolves the accountId via the email address. I'd recommend using the "find users by query" REST API for it. As query parameter, you can specify your email address.

From the response, you should be able to parse the accountID

Like Matias Costa Meneses likes this
Matias Costa Meneses November 18, 2020

thanks a lot Matthias!!

Matias Costa Meneses November 18, 2020

Hi Matthias, i was trying putting de accountId but it doesnt work.. i receive the same error, 400 bad request.  

im sending in this format

{ 
fields: {
  project: {
    id: "10000"
},
reporter: {
accountId: "The_accountId_of_the_user"
},
summary: "testAccJira",
description: "descripcion del issue ",
issuetype: {
id: "10001"
}
}
}


 

Could you tell me if there is something else that i should do? did it work for you?

Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2020

I tried it basically with the same request - and it worked. Does the error tell you more what is wrong? Maybe an invalid accountId?

Here's my request:

{
"fields": {
"summary": "create test",
"project": { "key": "CA" },
"reporter": { "accountId": "The_accountId_of_the_user" },
"issuetype": { "name": "Task" }
}
} 
Matias Costa Meneses November 25, 2020

Hello Matthias! thanks for help me! Yes, now it is working, but I think that day they were making a change or modifying something, because I did not change anything and the next day it started working

1 vote
Szabolcs Kiss
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2020

Advanced issue search -> enter JQL reporter = your_name

In the parentheses you will see the username 

Suggest an answer

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

Atlassian Community Events