Hello,
Preface: Not too technically inclined yet, and this is my first time handling most of these actions. I am a site-admin with full permissions. I've collected this idea from community posts, ChatGPT, and other experience with Jira scripts
Requirements: When an issue is transitioned from "status A" to "status B", as long as certain criteria are met, it will automatically create a Confluence page with information from that Jira issue card.
I saw that using the "Send Web Request" action in automation might be able to solve this problem. I will post screenshots of my automation below and walk through what I have so far.
Question:
Any help or guidance is greatly appreciated.
General View of Rule:
Very basic rule. When issue moves, if it's a certain type please create a page. All information is filler information for now.
Specifics of "Send web request:"
Below are screenshots of the action.
I do know the URL posted in the screenshot is going to be deprecated in 2025. When the rule is actived, this URL leads to this error:
Unable to publish the web request - received HTTP status response:
403
Error found in the HTTP body response:
{"message":"current user not permitted to use Confluence","statusCode":403}
When I use the URL for Confluence Rest API 2.0:
https://domain.atlassian.net/wiki/rest/api/v2/pages
I receive this error:
Unable to publish the web request - received HTTP status response:
404
Error found in the HTTP body response:
{"message":"null for uri" https://domain.atlassian.net/wiki/rest/api/pages/","statusCode":404
I can't tell what API you are using to update the page but I don't see the page ID anywhere which would explain the 404 response.
You may need to use the Update page API but you need to add an action after the create page step to capture the page ID of the most recently created page.
To capture the page ID use a Create Variable action to set the value of {{createdPage.Id}} into a variable such as pageId then when you make the PUT web request to update the page your endpoint will be domain.atlassian.net/wiki/rest/api/pages/{{createdPage.Id}}
Hello @Rick Westbrock ,
Per your comment and @Bill Sheboy I've made some progress.
In the beneath images, I have:
The information I'm attempting to update is quite simple for now. I just want to change the title of the page, and increase the version increment by 1.
I now get a different Error 404.
I took the same payload information and put it into VSCode in Python format, ran the script, and it updated the already existing page that was just created by the first part of my automation in Jira. So, I've confirmed the endpoint, the page id, and the payload reads in Python and are correct.
Would you be able to explain why it's not working in the Jira Automation Web Request action? I feel like I'm missing something simple.
Updated Automation Flow:
Updated Web Request Info:
New Error Code:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As long as the account you are using in the Authorization header has view and update permissions for the space then I can't explain why the web request action in the automation rule gets back a 404 error when making the same call from your script works fine.
I do see that the Update Page API requires body in the request body but I don't see that in your JSON. I would expect that a missing element in the request body would return an HTTP 400 but I've seen some odd response codes from Atlassian before. I find it really odd that body is required because if you are just changing the page title (for example) why should you have to send the existing page body in the request?
I suppose it might be worth making the body a smart value in the automation rule then use that to pass in the request body of the web request action to see if that helps? If you aren't passing that in your Python code then that element may not actually be required despite what the documentation says.
I haven't personally used this API myself so the best I can offer at the moment is the list of reasons for a 404 Not Found error from the documentation:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the prompt reply. Maybe my authentication is off in the automation rule while the script is correct, so I'll check that out. I'll also add the body. It worked without declaring a string for an updated body it in the script, but maybe I did something wrong. It's typically user-error for me haha.
Thanks again and I'll report back what I find.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Rick Westbrock Just coming back to say that the above didn't make the rule work. Same information still works in my scripts, but not in the web requests. Submitted a ticket to Atlassian support. Not sure if they handle these questions but *shoulder shrug* worth a shot.
Thanks for your time, and response in trying to answer this question!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My pleasure and for what it's worth I have worked with Support several times on strange automation rule problems and they have always been very helpful. Sadly sometimes the answer is "known issue with no workaround" but at least I got closure in those instances.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Rick Westbrock I got it to work. I ended up generating a new API token and found these two useful articles about what I was trying to do.
Jira Automation: Updating a Confluence page with i... - Atlassian Community
Jira Automation: Linking a Confluence page with Ji... - Atlassian Community
Key difference in the above two links were calling a "Pages by ID" endpoint, rather than just a "get pages" and that seemed to do the trick.
Thanks for the inspiration to keep working on it :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The error messages indicate that you're trying to send requests to the pretend, dummy domain called 'domain.atlassian.net'.
You've blanked out that part of your request, so there's no way of knowing what your actual, real, domain name is or whether that's what you used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I replaced my actual domain name with "domain" just for security reasons. Where "domain" is listed, it's leading to my company's Jira URL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problems. I needed to ask because sometimes people use that dummy domain literally, and you provided an example where you got a 404 error and a message that inferred just that.
If you want to interact with REST APIs more often, you really need to get a test tool like Postman so that you can check all parts of your request work first, before transposing it to a workflow. This cuts down on the guesswork when trying to determine where any potential fault lies.
Have fun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome. I'll checkout Postman. Have never used that before but if it makes things simpler that sounds good to me. Thanks for the tip! Happy new years!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do not know the answers to the questions you list, and...
I normally use this endpoint to create a page: https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-post
Also, as you describe creating the page with data from the trigger issue, I have found it easier to use the built-in action to create the Confluence page, delay and get it with another endpoint call (to confirm it is available), and then update the page with a third endpoint call, ensuring I increment the version number to 2. You could try it in one call by passing the needed body value information.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Bill Sheboy ,
Thank you for your comment. I took some of your ideas, and @Rick Westbrock in attempt to fix the problem. I'm still encountering an error. Please feel read to that response if you want to see what I did.
I do have a separate question for you.
In your comment you mention three endpoint calls. Are these three separate Jira Automation rules? If yes, I'm curious how it would be setup in three different rules, and why? Do you find bug hunting is easier this way?
Thanks for your response!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The three calls I was noting were to add enough delay and confirm the presence of the page before proceeding. These were still all in one rule.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.