Good morning Atlassian-Team,
I have an issue similar to the existed topics below, but slightly different. I should create an automatic jira rule for my company.
The goal of the rule should be:
When an issue is created or manually activated
for work items with issue type "Epic",
then Jira Automation should create a confluence page
in a specific customer page/location (pageID).
Describtion:
The idea is first to create a page for created jira issues in a central place via the method Publish a new page in Confluence and then to move to them to the right place. Based on my information I have to use REST API for moving those pages , because the embedded method in jira automation can only target single places. That would mean, if I want a general rule for more customers I would need for every customer the same rule with other parameters. But this is obviously too much if there are a lot of customers.
My current progress for this rule:
Trigger: manually triggered
Condition applied: Issue Type equals Epic
Then: Publish a new page in Confluence
Then: Send Web Request (Get) # Check CQL where pages are saved
Then: Create variable
Then: Send Web Request (Get) # Check CQL where to move the location based label/projectkey
Then: Create variable
Then: Send Web Request (Post) #Move to specific PageID
Status of my progress:
My rule don't work, because I get the error message that my Get-requests URL are invalid.
First Get-Request URL:
https://collaboration.your.site/wiki/rest/api/content/search?cql=space=CustomerPage%20AND%20type=page%20AND%20ancestor=pageID%20AND%20title={{createdPage.title}}&limit=1
Second Get-Request URL:
https://collaboration.your.site/wiki/rest/api/content/search?cql=space=CustomerPage%20AND%20type=page%20AND%20label={{issue.project.key.toLowerCase}}&limit=1
Third Post-Request URL:
https://collaboration.your.site/wiki/rest/api/content/{{reportSearch.body.results.first.id}}/move
What is the issue here? Is there another easier way to solve the task?
Thank you for your help!
Best regards,
Artur
Related topics:
1. Best-way-to-create-Confluence-page-from-a-JIRA-issue
2. Creation-of-confluence-page-mandatory-when-creating-an-issue
Hi @Artur
Are all API calls not working?
What is the result on just using your browser on each API call, does this give a result?
What kind of API token did you create?
Hi Marc,
1) Yes all API Calls aren't working.
2) First two Get-Requests, when using in browser get's brower page "We'll be back in a flash", which is probably an 404 error.
The third Post-Request get this message:
This XML file does not appear to have any style information associated with it. The document tree is shown below
It's also an 404 Error message, but it's probably, because the first Get-Requests have no results.
3) I created an API-Token from Account Settings -> Security -> Create API token.
Ah I understand I should not have made an "normal API Token", but an API Token with scopes and that's why I probably get the error message "We'll be back in a flash"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Artur
You do need a full token.
Did you create one, what is the result on using any of the API calls?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Artur
Let's split the first call.
Do you get a result on using:
https://collaboration.your.site/wiki/rest/api/content/search?cql=space=CustomerPage
if this works, add
AND%20type=page
and so further, where do is start to fail?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the first URL it starts failing at:
title={{createdPage.title}}&limit=1
So that means the Webrequest doesn't find the created confluence page, even though the ancestor path where the template page exist is there.
maybe smart-value don't work like {{createdPage.title}} in the url?
Nevermind forget this, the question is solved through testing. The result is that the webrequest seems to work, but I get an error 403 that means I don't have the rights to make this get-request.
I have an general api-token, not api-token with scopes, but I can't do this get-requests for jira-rule, but I can use my backup-script with the same credentials (email:token).
Does that mean you need special rights to do get- or post-requests for jira-automation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.