Error 403 or 404 when using "Send Web Request" to create confluence page on issue transition in Jira

Morgan Watts
Contributor
December 27, 2024

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 do know the "Create Page" automation works, but that only creates a page and doesn't populate information based on the trigger card (if I'm wrong, please let me know). 

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: 

  1. Would anyone know what I am receiving error codes 403 or 404?
    1. As mentioned, I am a site-admin, project admin, and space admin for all the impacted locations. 
    2. I should be able to create the pages if the information is correct. 
  2. Is this even possible? Or am I on a goose chase?

 

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. 


general overview of rule.png

 

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

 

 

top half of send qebt.png

 

headers for rule.png

 

body of message.png

 

 

3 answers

1 accepted

2 votes
Answer accepted
Rick Westbrock
Contributor
December 30, 2024

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}}

Morgan Watts
Contributor
December 30, 2024

Hello @Rick Westbrock ,

Per your comment and @Bill Sheboy I've made some progress. 

In the beneath images, I have: 

  1. Added "Create Page" action
  2. Added a delay
  3. Logged the created PageID as a variable
  4. Added a "Log Action" to confirm the correct page ID, which it is. 

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 automation flow.png

Updated Web Request Info:

web request.png


New Error Code:

new error code.png

Rick Westbrock
Contributor
December 30, 2024

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:

  • The provided page does not exist
  • The user does not have permissions to view the page
  • The user does not have the needed permissions to update a page in the space
  • The user provides a parentId for a page that does not exist or they do not have permission to view
  • There are no spaces associated with the given spaceId
Morgan Watts
Contributor
December 30, 2024

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.  

Morgan Watts
Contributor
December 31, 2024

@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!

Like Rick Westbrock likes this
Rick Westbrock
Contributor
December 31, 2024

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.

Morgan Watts
Contributor
December 31, 2024

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

Like Rick Westbrock likes this
2 votes
David Bakkers
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.
December 27, 2024

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.

Morgan Watts
Contributor
December 30, 2024

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. 

David Bakkers
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.
December 31, 2024

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

Morgan Watts
Contributor
January 2, 2025

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!

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.
December 27, 2024

Hi @Morgan Watts 

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

Morgan Watts
Contributor
December 30, 2024

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! 

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.
December 30, 2024

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.

  • create the page
  • get the content for the page just created
  • update the page content
Like Morgan Watts likes this
Morgan Watts
Contributor
December 30, 2024

Roger, thanks for the clarification!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events