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,553,090
Community Members
 
Community Events
184
Community Groups

How to automate sending large amount of REST API requests, and field changes?

I have an Insight object schema, with an Object in it, called Computer.

This Computer object has 4 fields:

  • Name
  • CPU
  • RAM
  • Owner

All of these fields, except the one called "Name" are empty, and I have to give them value from a separate API endpoint.

I need the "Name" attribute to identify the Computer in the POST request sent to the separate API endpoint, and I need one request for each of the 3 fields I want to populate ( CPU,RAM, Owner),

For example, a request I can make looks like this:
https://separateAPI/api/{{computerName}}/Ram/
which returns the RAM of the computer I'm looking for.

So the problem is, I have lot's of Computers, I am looking for a way to automate sending the API requests for each Computer I have.

After some time of tweaking Automation for Jira, I am starting to think it's not the right tool for this, because I have to manually configure each API request sent out, as an action.

I am looking for an answer, if there is any way to achieve this in Automation in Jira, or which other tool would be able to help me? Or is it the worst case scenario, and I should write my own application for this?

1 answer

0 votes
Alex van Vucht (GLiNTECH)
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.
Jun 10, 2021

The new "When Object Changes" rules are great for bulk automations like this. I have been using the "Status" to manage when these automations are used.

In this response, I am going to assume that your endpoints return the values as a simple JSON object, eg. for RAM: {value:"16GB"}

In your case, I would do something like:

1. When Object is Updated in schema Assets

2. If IQL: objectType = Computer and Status = "Action Needed"

3, 4, & 5. Send outgoing webhooks for CPU, RAM & Owner

6. Edit object:

  • CPU: {{webhookResponses.get(0).body.value}}
  • RAM: {{webhookResponses.get(1).body.value}}
  • Owner: {{webhookResponses.get(2).body.value}}
  • Status: Active

To trigger an update, just do a Bulk Change of the Status attribute to "Action Needed". If you tick the "Allow this rule to be triggered by other rules", you must change the Status to something else at the first Edit Object rule otherwise you'll end up in a loop,

Finally, you may have encountered a particular frustration, which is that you can't call Text functions on Insight attributes. This means you can set the URL to https://separateAPI/api/{{object.Name}}/Ram/ but if you try to do https://separateAPI/api/{{object.Name.urlencode}}/Ram/ then the Name is blank and the request fails. This is because Automation is treating "Name" as if it was another object, and not a Text value.

It took me a few hours to work this out, but you have to dig into the object to get the Text representation of an attribute that allows you to call the Text functions. So this will work:

https://separateAPI/api/{{object.Name.values.get(0).displayValue.urlencode}}/Ram/

Hope this helps!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events