JIRA API - Create Issue with custom field multi select

nick magers June 7, 2017

I'm trying to create issues with a multi select set but it doesn't work. The other custom fields get populated but not the one below:

"customfield_10202" : [{"SLA Service" : "Search Services for Retail Customers"}]

 Whole curl command to create issue

curl -u admin:postgresql -X POST --data '{"fields":{"project":{"key":"SR"}, "summary":"hd", "description":"Creating of an issue using project keys and issue type names using the REST API", "issuetype":{"name":"Incident"}, "customfield_10200" : "538", "customfield_10201" : "hd", "customfield_10202" : [{"SLA Service" : "Search Services for Retail Customers"}], "customfield_10007" : "2011-10-19T10:29:29.908+1100", "customfield_10203" : "PIHOC9X", "customfield_10204" : "https://lpi-nsw.pagerduty.com/incidents/PIHOC9X", "customfield_10008" : "2011-10-19T10:29:29.908+1100"}}' -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue/

Response:

{"id":"10476","key":"SR-80","self":"http://localhost:8080/rest/api/2/issue/10476"}

 Retrieving Issue using API, field 10202 is empty

"customfield_10202":null,

Whole reponse of issue retrieval 

{
         "expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields",
         "id":"10476",
         "self":"http://localhost:8080/rest/api/2/issue/10476",
         "key":"SR-80",
         "fields":{  
            "issuetype":{  },
            "timespent":null,
            "project":{  },
            "fixVersions":[  ],
            "aggregatetimespent":null,
            "resolution":null,
            "resolutiondate":null,
            "workratio":-1,
            "lastViewed":"2017-06-07T17:19:36.252+1000",
            "watches":{  },
            "created":"2017-06-07T17:16:50.000+1000",
            "priority":{  },
            "customfield_10100":null,
            "labels":[  ],
            "timeestimate":null,
            "aggregatetimeoriginalestimate":null,
            "versions":[  ],
            "issuelinks":[  ],
            "assignee":null,
            "updated":"2017-06-07T17:16:50.000+1000",
            "status":{  },
            "components":[  ],
            "timeoriginalestimate":null,
            "description":"Creating of an issue using project keys and issue type names using the REST API",
            "customfield_10203":"PIHOC9X",
            "customfield_10005":"0|i000jj:",
            "customfield_10204":"https://lpi-nsw.pagerduty.com/incidents/PIHOC9X",
            "customfield_10007":"2011-10-19T10:29:00.000+1100",
            "customfield_10205":null,
            "customfield_10008":"2011-10-19T10:29:00.000+1100",
            "customfield_10206":[  ],
            "customfield_10207":null,
            "aggregatetimeestimate":null,
            "customfield_10208":null,
            "summary":"hd",
            "creator":{  },
            "subtasks":[  ],
            "reporter":{  },
            "customfield_10000":null,
            "aggregateprogress":{  },
            "customfield_10200":"538",
            "customfield_10201":"hd",
            "customfield_10202":null,
            "customfield_10004":null,
            "environment":null,
            "duedate":null,
            "progress":{  },
            "votes":{  }
         }
      }

But when I set it manually I see

"customfield_10202":[  
               {  
                  "self":"http://localhost:8080/rest/api/2/customFieldOption/10118",
                  "value":"Search Services for Retail Customers",
                  "id":"10118"
               }
            ],

 

1 answer

0 votes
Randy
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.
May 1, 2018

try:

 "customfield_10202" : [{"value" : "Search Services for Retail Customers"}]

Suggest an answer

Log in or Sign up to answer