Error creating issue via REST API - could not find valid 'id'

Peter Dittman October 28, 2013

Am writing a custom HTML form to create issues in JIRA via the REST API (rest/api/2/issue). One of the fields is a custom JIRA field with multiple options (single select), but I'm unable to create issues when I include that in the JSON. The error I'm receiving is "Could not find valid 'id' or 'value' in the Parent Option object. The JSON I'm supplying looks like:

{
  "fields": {
    "project": {
      "key": "PTP"
    },
    "customfield_10401": "my project request",
    "customfield_11700": "11610",
    "summary": "my project request",
    "description": "Compliance Program",
    "issuetype": {
      "name": "Epic"
    }
  }
}

where "customfield_11700" is the single select custom field. (customfield_10401 is "Epic Name").

The supplied id "11610" is a valid ID (known value) for the custom field - I retrieved it from the createmeta API.

I've tried to create an issue by supplying the 'ID' and the 'value' for the customfield_11700 with no success. I now the customfield_11700 is the offender because if I remove the 11700 field from the JSON, the issue is created successfully.

Any ideas on what I should try?

4 answers

1 accepted

13 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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.
October 28, 2013
0 votes
Suresh Sakhare September 24, 2017

I am facing same problem in jsd server apis.

I setting custome field value using FieldID and InputFieldValue classes.

input fields working as expected but select field not working.

It shows above error.

for input field i do following things.

 FieldId fID = FieldId.withId("1");

fVlaue = FieldInputValue.withValue("asd");

 

for select customfield field i do following things.

 FieldId fID = FieldId.withId("2");

fVlaue = FieldInputValue.withValue(FieldInputValue.withValue("selectedoption");

 

please help where i am wrong.

0 votes
Peter Dittman October 28, 2013

YES!!!! awesome!

thank you!

0 votes
Jobin Kuruvilla [Adaptavist]
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.
October 28, 2013

try passing the value and not the id. See examples here.

Peter Dittman October 28, 2013

Jobin, thanks for the suggestion and the link, but no luck. I tried a number of variations in the JSON, but I conclude there's something special about single select fields. Here's what I tried:

1. JSON using 'value' for customfield (FAIL):

{
  "fields": 
    { "project": { "key": "PTP"  },
    "customfield_11700": "Compliance",    <---  using value
    "summary": "my project request",
    "description": "project description",
    "issuetype": { "name": "Epic" }
  }
}

2. JSON using 'id' for customfield (FAIL):
{
  "fields": 
    { "project": { "key": "PTP"  },
    "customfield_11700": "11610",    <---  using id
    "summary": "my project request",
    "description": "project description",
    "issuetype": { "name": "Epic" }
  }
}

3. JSON using sqaure brackets (as shown in the examples) (FAIL):

{
  "fields": 
    { "project": { "key": "PTP"  },
    "customfield_11700": ["Compliance"],  <--- using value in brackets
    "summary": "my project request",
    "description": "project description",
    "issuetype": { "name": "Epic" }
  }
}

But then, I tried to update a custom field of type text - and that SUCCEEDED:

{
  "fields": 
    { "project": { "key": "PTP"  },
    "customfield_10600": "Compliance",    <---  using text field
    "summary": "my project request",
    "description": "project description",
    "issuetype": { "name": "Epic" }
  }
}

SOOO, that's what gets me to the conclusion that the single/multiple selects are expecting something different.

thoughts?

-Peter

At Th March 28, 2016

were you able to find a solution ? i am having the same problem

JIRA_USER September 21, 2016

I have almost the same issue.

image2016-9-21 13:38:15.png

Now, when I try to create a bug using cURl, I get error message as

image2016-9-21 13:36:24.png

My jason script is

image2016-9-21 13:39:44.png

But if i do "ID" instead of value im good. its working fine. My requirement is that I should not use ID because if I use ID it will always create a bug only with that ID. So how would i be able to use value instead of ID. Please advice.

Suggest an answer

Log in or Sign up to answer