How to retain 2 webresponse.body data for us in subsequent web requests?

Jar Lady April 2, 2024

Hi, 

So basically I am connecting to external API from jira automation rule. 

I created the following HTTP requests in the correct order:

1) GET value 1 from external API

2) GET value 2 from external API

3) POST value 1 & 2 external API

As you can see from above, I will need to perform 2 GET requests to retrieve 2 values first before injecting these 2 values into external API. When doing the GET requests, I will use webhookResponse.body.value to retrieve the value. How do I retain value 1 without overridden by the value 2 and without function to Create Variable? I am running on older version of Jira Software i.e .8.20.10 hence do not have the function to Create Variable. Please don't tell me to upgrade the software as I am not the owner.

1 answer

1 accepted

0 votes
Answer accepted
Kalyan Sattaluri
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.
April 2, 2024

Hello @Jar Lady 

What is the trigger for your rule.

If its an issue, store value 1 as an entity property after Step 1, do your POST and clear out the entity as last step.

Jar Lady April 2, 2024

Yep, the trigger is when the issue is created. Do you have example of how should I set he entity property? And how should I clear out in the Jira automation rule?

Kalyan Sattaluri
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.
April 2, 2024

See the last post in the below thread..

https://community.atlassian.com/t5/Jira-Core-Server-questions/How-do-I-access-a-User-entity-s-properties-set-via-API/qaq-p/92490

Basically from UI of automation, you will store the value1, maybe as below:

{ "Value1" : "{{webhookResponse.body.value}}"}

then you can reference it as

{{issue.properties.yourpropertyname."value1"}}

to delete, you can make a REST Call to below endpoint:

/rest/api/2/issue/{issueIdOrKey}/properties/{propertyKey}

See below link:

https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-properties/#api-rest-api-2-issue-issueidorkey-properties-propertykey-delete

Kalyan Sattaluri
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.
April 2, 2024

Please see below screenshot for sample, of course I am skipping your web request call and directly jumping to setting entity value.

 

image.png

Like Jar Lady likes this
Jar Lady April 4, 2024

Thank you! It works! However when deleting an issue entity property, there is error saying I do not have permission to edit issues in this project. But I am a project admin and I can edit issues in the project already. Which permission is lacking?

Kalyan Sattaluri
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.
April 4, 2024

Hello @Jar Lady 

Please cross check the credentials you are passing in your REST call to Jira. I see you have tagged it as Server and I am in DC. Not sure the difference. But I follow below link for my set up:

https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html

Basically, I go to Jira's settings, create a Personal Access Token.

Then in Automation Rule, I provide Authorization Bearer <token> when making your call.

image.png

Hope it helps.

Like Jar Lady likes this
Jar Lady April 4, 2024

No wonder. Thank you! 

Like Kalyan Sattaluri likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
This widget could not be displayed.
TAGS
AUG Leaders

Atlassian Community Events