REST API - numerous calls now throwing an error

Lee Correll
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.
February 19, 2020

Looks like a change was made to remove the "name" attribute from my projects and issues - the only field available (to assign an issue, for example) is now "displayName."

I"m having numerous issues, all of which seem to be related to the removal of this field - but I can't seem to use displayName to do anything, either.  I can't create / edit / or do much of anything that's user based on an issue.

I'm using assigning an issue as a touchstone here -  The 8.7.1 documentation says I should be able to do something as basic as 

{ "name": "harry" } with PUT /rest/api/2/issue/{issueIdOrKey}/assignee

but "name" doesn't work, "displayName" doesn't work - I can't find an option that's viable. 

Any suggestions? 

6 answers

1 accepted

0 votes
Answer accepted
Lee Correll
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.
February 19, 2020

So I got an answer back - because I opened an issue then escalated.

It's part of their change to remove userIDs and use accountIDs instead.

Why another member of their customer base has to tell you this is beyond me - it must be how they make money left and right.  It's documented, but, again, Atlassian can't be bothered to inform us they're making the change on a given day - we have to go find the info when our apps break.

Go here:

https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/

Stefan C. February 20, 2020

Hi,

you write "By 29 April 2019" but why has "name" gone in the "issue" api last week and not one year ago?

(see https://community.atlassian.com/t5/Jira-questions/JIRA-REST-API-missing-parameters/qaq-p/1302944 )?

0 votes
Lee Correll
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.
February 20, 2020

I've managed to shift some of my code to accountId successfully, so that part works.  I can post some JSON if that helps anybody.

emaynard February 20, 2020

Please do, we aren't getting accountId. We get nothing related to assignee's, reporter etc.

Lee Correll
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.
February 20, 2020

So I'm using powershell, but this should be easy enough.  Their docs say that the initial search for the accountId is one "where the value can be an email address, display name, or any other user attribute."

I'd use email address, because I've learned the search does not always return a single accountId, even if I use what I perceive as a unique username.

$restapiuri = "$baseurl/rest/api/latest/user/search?query=$name"
$jsonresponse = invoke-restmethod -uri ($restapiuri) -Headers $httpheader -method get -contenttype "application/json"
if ($jsonresponse -ne "") {return ($jsonresponse.accountId)}

gets me an accountId.

Then to set the assignee:

$body = "{`"accountId`":`"$assigneeId`"}"
$restapiuri = "$baseurl/rest/api/latest/issue/$Issue/assignee"+ "?notifyUsers=false"
$jsonresponse = invoke-restmethod -uri ($restapiuri) -Headers $httpheader -method put -contenttype "application/json" -body $body

Works for me.

Lee Correll
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.
February 20, 2020

and the JSON for $body in the assignee setting routine:

{"accountId":"55xxxxx:69bb27f2-4xce-4x9b-9x87-xxxxxxxxx"}  where the x's are numbers that I removed.

0 votes
Ewelina Nowakowska
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2020

Changing my app to use accountId instead of name worked. This affects assignee and reporter.

You can easily look up the id of a user now from inside advanced search using the JQL, it will still allow you to search by name but once you select it, the id will be revealed. 

I reached out to HelpScout because their JIRA integration is also affected by this. 

Why this wasn't officially announced like the API Tokens for basic auth, is beyond me but glad this community exists so we can help each other!

0 votes
emaynard February 20, 2020

But we aren't getting accountId either. assignee, reporter etc. are all null.

0 votes
Ewelina Nowakowska
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 19, 2020

Also experiencing issues with the API while no recent changes has been made to our codebase, just can't create tasks anymore. I can confirm everything was operational yesterday. 

David Young February 19, 2020

I'm experiencing the issue as well, starting some time early-mid afternoon CT yesterday.  If I include "assignee":{"name":"some-user"} in the REST API body, I'm getting a 400 with "Issues must be assigned" in the "errors" object in the response body.  Our code that calls Atlassian's REST API has not been touched in a while, which makes me think something is broken on their end.  FWIW removing the assignee from the REST API call results in a successful 201 response.

wdlaskin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 19, 2020

I'm getting a similar error via the Java REST client API. It was working until a few days ago. Now we get an exception when we try to create a new issue: 

Caused by: org.codehaus.jettison.json.JSONException: JSONObject["name"] not found.
at org.codehaus.jettison.json.JSONObject.get(JSONObject.java:360) ~[4851c14d-6b7cb8c3:1.1]
at org.codehaus.jettison.json.JSONObject.getString(JSONObject.java:487) ~[4851c14d-6b7cb8c3:1.1]
at com.atlassian.jira.rest.client.internal.json.JsonParseUtil.parseBasicUser(JsonParseUtil.java:192) ~[c8b6915-40a88a76:?]
at com.atlassian.jira.rest.client.internal.json.UserJsonParser.parse(UserJsonParser.java:34) ~[c8b6915-40a88a76:?]
at com.atlassian.jira.rest.client.internal.json.UserJsonParser.parse(UserJsonParser.java:31) ~[c8b6915-40a88a76:?]
at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.getOptionalNestedField(IssueJsonParser.java:300) ~[c8b6915-40a88a76:?]
at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parse(IssueJsonParser.java:235) ~[c8b6915-40a88a76:?]
at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parse(IssueJsonParser.java:88) ~[c8b6915-40a88a76:?]
at

Suggest an answer

Log in or Sign up to answer