Can't get curl to post to my custom field

Dee Heffemm March 19, 2018

I am trying to post an issue to JIRA Service Desk which requires a multi-select custom field to be filled in (customfield_10900) which references an object in a Riada Insight schema (a server hostname).

I found an article here which is similar but I'm not sure what I should use in the identifier field of the hostname JSON data. I have tried name, Name, ID but none of them seem to produce a populated item.

Have been looking around for a couple hours for different ways to populate this field but I think I might be missing something particular to Insight. Any thoughts?

I can view a list of issues using this URL. The entries I've tried from curl return null for customfield_10900.

https://jira.my.domain.com/jira/rest/api/2/search?jql=project=SD&fields=key,description,issuetype,summary,customfield_10900

An issue (correctly) created in the web browser returns this for the custom field. It appears there is a reference to the Insight schema INTES-3891 but that is not visible on the issue or in the field:

customfield_10900 
0 "kreger.my.domain.com (INTES-3891)"

This is my JSON data file /tmp/tmp.jcBZd0ufL2:

{ "fields": { "project": { "key": "SD" }, "summary": "Test post from curl", "description": "Test description", "issuetype": { "name": "Change Log" }, "customfield_10900":[{"name" : "desktop.test.my.domain.com"}] } }

 

My curl command and returned query ist like this:

test$ curl -D- -u ${CURLUSER}:${CURLPASS} -X POST --data @/tmp/tmp.jcBZd0ufL2 -H "Content-Type: application/json" https://jira.my.domain.com/jira/rest/api/2/issue/ 


HTTP/1.1 201
Server: nginx
Date: Mon, 19 Mar 2018 18:37:51 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-AREQUESTID: 817x3635x1
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-ASEN: SEN-10430660
Set-Cookie: JSESSIONID=874BACFFA25E344BDAFC9DB9052C8FB3;path=/jira;HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=BP2A-NQK9-797D-MZ7M|6b63a4a909c190e37113e52ece0e6a5ef12c44a7|lin;path=/jira
X-ASESSIONID: v3500b
X-AUSERNAME: user101
Cache-Control: no-cache, no-store, no-transform
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload

{"id":"10912","key":"SD-25","self":"https://jira.my.domain.com/jira/rest/api/2/issue/10912"}

 

1 answer

1 accepted

0 votes
Answer accepted
Alexander Sundström
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.
March 21, 2018

HI This an example of the data needed when creating an issue, and what is needed for the Insight custom fields is the Key:

{
"fields": {
"project":
{
"key": "SCRUM"
},
"summary": "Always do right. This will gratify some people and astonish the REST.",
"description": "Creating an issue while setting custom field values",
"issuetype": {
"name": "Story"
},
"customfield_11500": [{"key":"MS2-15"}]
}
}

And here is an example of when editing an issue:

example.png

If you feel like this answered your question, please mark it as accepted :)

Cheers!
Alexander

Suggest an answer

Log in or Sign up to answer