Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Asset customfield not populated via cloud Rest API Edited

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

1 answer

1 accepted

0 votes
Answer accepted

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()

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you