Hello,
we try to populate asset customfield with Rest API post function in Jira Cloud. There are no errors in script log, yet the asset field is not populated:
// get the asset
def asset = get('/rest/assetapi/asset/com.riadalabs.jira.plugins.insight/1612_3')
.header('Content-Type', 'application/json')
.asJson()
.getBody()
.getArray()
// populate asset customfield on issue
def restApi ='/rest/api/3/issue/TEST-31'
def result = put (restApi)
.header('Content-Type', 'application/json')
.body([
fields: [
customfield_10055 :asset,
]
]
)
.asJson()
No errors in log:
GET /rest/assetapi/asset/com.riadalabs.jira.plugins.insight/1612_3 asJson Request Duration: 1722ms PUT /rest/api/3/issue/TEST-31 asJson Request Duration: 498ms
Console result:
{ "delegate": { "headers": { "server": [ "AtlassianProxy/1.15.8.1" ], "Connection": [ "keep-alive" ], "strict-transport-security": [ "max-age=315360000; includeSubDomains; preload" ], "Date": [ "Fri, 31 Jan 2020 09:27:23 GMT" ], "atl-traceid": [ "9c4a6ea40f60c977" ], "duration": [ "479" ], "x-xss-protection": [ "1; mode=block" ], "x-content-type-options": [ "nosniff" ], "x-arequestid": [ "c553227e-8e00-466e-88c0-4c641cdc9d01" ], "x-aaccountid": [ "blahblah" ], "correlationId": [ "11cf740b-9014-40cb-aa8b-38e27650d976" ], "timing-allow-origin": [ "*" ], "cache-control": [ "no-cache, no-store, no-transform" ], "Content-Type": [ "application/json;charset=UTF-8" ] }, "statusText": "No Content", "parsingError": { "present": false }, "body": null, "status": 204 }, "headers": { "server": [ "AtlassianProxy/1.15.8.1" ], "Connection": [ "keep-alive" ], "strict-transport-security": [ "max-age=315360000; includeSubDomains; preload" ], "Date": [ "Fri, 31 Jan 2020 09:27:23 GMT" ], "atl-traceid": [ "9c4a6ea40f60c977" ], "duration": [ "479" ], "x-xss-protection": [ "1; mode=block" ], "x-content-type-options": [ "nosniff" ], "x-arequestid": [ "c553227e-8e00-466e-88c0-4c641cdc9d01" ], "x-aaccountid": [ "blahblah" ], "correlationId": [ "11cf740b-9014-40cb-aa8b-38e27650d976" ], "timing-allow-origin": [ "*" ], "cache-control": [ "no-cache, no-store, no-transform" ], "Content-Type": [ "application/json;charset=UTF-8" ] }, "status": 204, "statusText": "No Content", "body": null, "parsingError": { "present": false } }
What are we missing in our code / customfield settings?
Many thanks
BR / Adam
Resolved - we sent the data in following format:
def restApi ='/rest/api/3/issue/TEST-31'
def result = put (restApi)
.header('Content-Type', 'application/json')
.body([
fields: [
customfield_10055 :[[
originId: "1612_1",
serializedOrigin: "com.riadalabs.jira.plugins.insight/1612_1",
appKey: "com.riadalabs.jira.plugins.insight",
value: "com.riadalabs.jira.plugins.insight/1612_1",
]]
]
]
)
.asJson()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.