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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,460,642
Community Members
 
Community Events
176
Community Groups

Saving multiple IDs from WebResponse into a single SmartValue

I am wanting to save the ID numbers returned from an API call into a Single Smart Value. I then want to reference each ID in the smartvalue to use in future outgoing web requests for automation.

 

I start by using this

GET: https://<<domain>>.atlassian.net/rest/api/3/dashboard/<<dashboardid>>/gadget

 

Which successfully returns the following response:

 

{
"gadgets": [
{
"id": 13715,
"moduleKey": "com.atlassian.plugins.atlassian-connect-plugin:com.stonikbyte.great.gadgets.plugin__filter-based-formula",
"color": "green",
"position": {
"row": 0,
"column": 0
},
"title": "Story Points Remaining"
},
{
"id": 13716,
"moduleKey": "com.atlassian.plugins.atlassian-connect-plugin:com.stonikbyte.great.gadgets.plugin__filter-based-formula",
"color": "green",
"position": {
"row": 0,
"column": 1
},
"title": "Bugs Remaining"
},
{
"id": 13717,
"moduleKey": "com.atlassian.plugins.atlassian-connect-plugin:com.stonikbyte.great.gadgets.plugin__release-gadget",
"color": "green",
"position": {
"row": 1,
"column": 0
},
"title": "Burndown"
},
{
"id": 14950,
"moduleKey": "com.atlassian.plugins.atlassian-connect-plugin:aptis.plugins.epicSumUp__aptis-esu-dashboard-gadget",
"color": "blue",
"position": {
"row": 2,
"column": 1
},
"title": "Epic Sum Up Filter Results"
},
{
"id": 13718,
"uri": "rest/gadgets/1.0/g/com.atlassian.jira.gadgets:filter-results-gadget/gadgets/filter-results-gadget.xml",
"color": "green",
"position": {
"row": 3,
"column": 0
},
"title": "Filter Results"
},
{
"id": 13719,
"uri": "rest/gadgets/1.0/g/com.atlassian.jira.gadgets:filter-results-gadget/gadgets/filter-results-gadget.xml",
"color": "green",
"position": {
"row": 4,
"column": 0
},
"title": "Filter Results"
},
{
"id": 13714,
"uri": "rest/gadgets/1.0/g/com.atlassian.jira.gadgets:stats-gadget/gadgets/stats-gadget.xml",
"color": "green",
"position": {
"row": 2,
"column": 0
},
"title": "Issue Statistics"
},
{
"id": 13960,
"uri": "rest/gadgets/1.0/g/com.atlassian.jira.gadgets:pie-chart-gadget/gadgets/piechart-gadget.xml",
"color": "blue",
"position": {
"row": 1,
"column": 1
},
"title": "Pie Chart"
}
]
}
I then want to create a single smartvalue that is comprised of only the id numbers returned in the GET, like [13715, 13716, 13717, etc....]
I would then like to reference each of those values individually in an outgoing webrequest url later on in my automation. example...[0] for 13715 or [1] for 13716.
Can you assist me with these steps? Thanks!!

2 answers

1 accepted

0 votes
Answer accepted

I wasn't able to figure out how to grab any of the indexed values of my JsonArray, however, I was able to completely change my method and instead of defining 1 smart value as an array, I grabbed each id and saved it as a variable independently. This was a huge pain but it works....

 

If someone figures out how to reference the value in a jsonArray via a smartvalue method, please let me know!!

 

Thanks :)

In my testing I was able to successfully create a smartvalue {{itemIds}} by using the following:

 

{{webResponse.body.gadgets.id.asJsonArray}}

 

which returns:

 

[13715,13716,13717,14950,13718,13719,13714,13960]

 

Now I just need to figure out how to reference each of those values independently with a SmartValue function.. like.

 

{{itemIds.get(0)}}

I'm having the same issue.

 

Any luck? 

Suggest an answer

Log in or Sign up to answer