I am trying to add the custom field to my issue using REST API,but its not working for me.

Sanjay Sreenivas January 18, 2018

Hi,

I am trying to add the custom field to my issue using REST API,but its not working for me.

REST : http://localhost:8222/rest/api/2/issue

Method : POST

Body : 

---------------------------------------------------------------

{
"fields": {
"project": {
"key": "TRAIL"
},
"summary": "san2_bug12",
"description" : "desc",
"priority": {
"id": "1"
},
"issuetype": {
"name": "Bug"
}
},
"customfield_10101" : {"name" : "custom"}
}

 

----------------------------------------------------------------

I am getting error,

----------------------------------------

{
"errorMessages": [],
"errors": {
"customfield_10101": "AginTesting is required."
}
}

---------------------------------------

It will work when i change to the custom field to optional, but i need to add the custom filed to issue.

 

Please help me.

1 answer

0 votes
Alexey Matveev
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.
January 18, 2018

Hello,

What is the type of your custom field?

Sanjay Sreenivas January 18, 2018

Hello Alexey,

Its Text filed(Single Line)

Alexey Matveev
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.
January 18, 2018

Try like this

{
"fields": {
"project": {
"key": "TRAIL"
},
"summary": "san2_bug12",
"description" : "desc",
"priority": {
"id": "1"
},
"issuetype": {
"name": "Bug"
}
},
"customfield_10101" :  "custom"
}

Sanjay Sreenivas January 18, 2018

No @Alexey Matveev..it showing the same error.

Suggest an answer

Log in or Sign up to answer