Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

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

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
Community showcase
Published in Marketplace Apps & Integrations

☕️ Monday coffee with Jexo: Weekly Atlassian news roundup | 21st June 2021

Hi community 👋, as every Monday we're bringing you a quick update on what happened in the Atlassian ecosystem last week. There were a few interesting events like for example the announcement of th...

59 views 0 6
Read article

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