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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to assign a Insight object to a custom field using Rest API?

Hey there, 

I just have an issue type that goes with an Insight object under a customfield.

However, i can not manage to create this issues neither using Jira for Python lib or Jira REST API directly.

I went over these two topics below, and none of the solutions worked for me

https://community.atlassian.com/t5/Jira-Service-Management/JSON-body-example-that-links-an-Insight-object-to-a-JSM-issue/qaq-p/1986713

https://community.atlassian.com/t5/Jira-Service-Management/Jira-API-Insight-object-customfield/qaq-p/1276723

 

for the payload as 

{

"fields": {

"project":{"key":"DEMO1"},

"summary": "Create JIssue test",

"description": "Create Jissue test",

"issuetype": {

"id": "10213"

},

"customfield_10424" : [{

"workspaceId":{workspace_id},

"id":"446",

"objectId": "446"

}]

}

}

i just got a server error

{"errorMessages":["Internal server error"],"errors":{}}

if i replace the insight object formatting, and pass only the key, the ticket is created, but with the customfield as empty.

{

"fields": {

"project":{"key":"DEMO1"},

"summary": "Create JIssue test",

"description": "Create Jissue test",

"issuetype": {

"id": "10213"

},

"customfield_10424" : [{

"key":"CUS-445"

}]

}

}

 

This is how a manually issue, with Insight object properly set, looks like for the customfield

 

jira.png 

if i just try to update that issue by code, using:

issue.update(fields={'customfield_10424':[{

"key":"CUS-175"

}]})

 the customfield_10424 will go empty. 

empty.png

I would be pleased if someone could help me figure this out, or maybe explore other alternatives, Thanks!

1 answer

1 accepted

After going deeper on that, just found out the syntax that worked for me.

customfield_10424=[{

"id":"{workspaceId}:445",

}]

idk why this is not well document over jira docs, since there are similar scenarios and different syntaxes.

Hi Andre, I just have a question, what is "workspaceid" is it the name of your object ?

Can you confirm as I'm switching form server version to Cloud and the call api is not possible with the old method with the key.

 

Thanks.

I tried with that 

"customfield_10302": [

{

"id": "{workspaceid}:19403"

}

]



and get 

{

"errorMessages": [],

"errors": {

"customfield_10302": "Validation failed for Insight object"

}

}

I just the solution on how to find the workspaceid, for those looking here and that don't know just make a call to :

 'https://{yourcompany}.atlassian.net/rest/servicedeskapi/insight/workspace' 

Like Matteo Vecchiato likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events