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

Issue custom field update through REST API does not work

Laurent Delhaie
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!
June 4, 2024

My aim is to integrate our Salesforce.com platform with our Jira Service Management platform.

For this, I'm first using Postman to test my API call-outs, but I'm currently stucked on this problem: I can't manage to update the text custom filed I created (customfield_10082) to set back the reference from Salesforce object I create from Jira issue.

In order to update this field I'm doing a PUT on http://MYJIRA.atlassian.net/rest/api/3/issue/{issuekey}, using following JSON:

 

{

    "fields": {

        "customfield_10082" : "SFDC Ref"

    }

}

Postman is receiving a "200 OK" response code, but when looking at the received JSON or in the Jira app itself, I can see my custom field remains desperately empty:

 "customfield_10082": null

When doing a GET on http://myjira.atlassian.net/rest/api/2/issue/SP-13/editmeta I'm getting the following definition for the field I need to update through REST API:

"customfield_10082": {
"required": false,
"schema": {
"type": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:textfield",
"customId": 10082
},
"name": "ST Reference",
"key": "customfield_10082",
"operations": [
"set"
]
}

Am I missing something? Maybe am I required to use this "set" operation for the update?

But what's the syntax for using it in my JSON in this case? Or do I have to use the "update" verb instead of "fields" for the update?

I found this example for setting components, but I don't know how to apply this to my custom field:

{ "update" : { "components" : [{"add" : {"name" : "Engine"}}] } }

source: Jira REST API examples (atlassian.com)

Note that the same page also seems to confirm above JSON structure I am currently using for custom field (free text) update. I just feel like I'm going in circles...

Thanks a lot for your help!

 

1 answer

0 votes
Kalyan Sattaluri
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.
June 4, 2024

Hello @Laurent Delhaie 

Can you confirm the end point you are using? You have it as below:

 http://MYJIRA.atlassian.net/rest/api/3/issue/{issuekey}

But the syntax is not right. It should be:

 http://MYJIRA.atlassian.net/rest/api/3/issue/{{issuekey}}

 

Other than that, everything looks good.

this field allows only "set" operation and using "fields" you are implicitly doing a set. So that's good. Even the meta info shows its a text field so the way you are updating is the correct way. 

Please cross check the smart value in your endpoint. Hope it helps. Thanks! 

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