Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Consigo fazer uma comparação para saber se meu web request teve sucesso?

Cesar Bastos October 3, 2022

Fiz uma integração via API e gostaria de utilizar a condição parecida com: 
Se "Send web Request" contains "Successfully published web request", transicionar item para a fila "X". 
É possivel fazer essa comparação?

3 answers

1 accepted

0 votes
Answer accepted
Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 4, 2022

@Cesar Bastos , please try to replicate this steps

Step 1: Even if your Send Web Request is empty, it is possible to collect the sending log of this request through the jira log action. For that, you need to check this box in the Action of "Send Web Request":

Screenshot_52.png

Step 2:

After the "Action" of the Send Web Request you will add a new Action called "Log Action" and this log action will include the following variables: {{webResponse.status}}{{webResponse.statusCategory}}

Just copy and paste :)

Response.status = Success code (200 if ok)
Response.statusCategory = Status Category (Success, error, etc)

Screenshot_53.png

Step 3: After the Log Action, I added a new action in the automation called "Re-fetch". This is like a Jira base refresh and particularly I just used it to ensure that when jira starts reading the statusCategory condition, it will find value in the log.

 

Step 4:

After the re-fetch open a BRANCH for the Current Issue (or the target issue you want).

Inside this branch, you will add a condition like "Advanced compare condition" and put the following configuration in it:

Screenshot_54.png

Step 5:

After performing the comparison condition, still inside the BRANCH, add the final Action of your rule. What do you really want to do if the web response result is successful (transition issue, edit issue, comment issue, etc).

In my case I put a comment issue and it worked perfectly in this logic. See the complete log of my automation:

Screenshot_55.png

Forgive me if I forgot something, but it's important to know that you can turn the result of your web request into a condition using this logic, so from there you can build a better automation that will do what you need.

Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 4, 2022

That is my complete automarion rule:

Screenshot_56.png

1 vote
Bill Sheboy
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.
October 3, 2022

Hi @Cesar Bastos 

For a question like this, please include images of your complete automation rule and the audit log details showing the rule execution.  Those will provide context for the community to offer suggestions.

For you Send Web Request action, did you enable the option to "Wait for response", and then check the response values, as @Burak Bal suggested?

Kind regards,
Bill

0 votes
Burak Bal October 3, 2022

Hi @Cesar Bastos

You can use Log Action and you can see status of request with {{webhookResponse.status}} smart value. I assume that the web request is sent with Jira Automation.

Cesar Bastos October 3, 2022

This does not work because the API return me nothing in the body. I need something to compare if the rule worked successfully

Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 3, 2022

@Cesar Bastos , can you confirm if this Send Web Request is sent with jira automation?

Because even the body is EMPTY, if it has been sent by jira automation you can take the code and/or category status from your web request. Then you can use one of them as a conditional for your automation rule.

Cesar Bastos October 4, 2022

Yes, is it send with Jira Automation. How can i use this as a conditional for my automation?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events