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

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

0 vote

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

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

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

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.

YES!!!! awesome!

thank you!

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.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,176 views 13 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot