I'm trying to create automation rules in Confluence Cloud programmatically using the REST API, but I'm getting 404 errors on all automation endpoints.
What I'm trying to do:
Endpoints I've tried:
https://[site].atlassian.net/wiki/rest/api/automation/rule
https://[site].atlassian.net/wiki/rest/api/automation
https://[site].atlassian.net/rest/api/automation/rule
What works:
/rest/api/space
Questions:
Hi @Ganesh Naiknavare and welcome,
please take a look to the following documentation https://developer.atlassian.com/cloud/automation/rest/intro/#about in order to retrieve information about what type of operation you can perform on automation through rest api.
Hope this clarifies,
Fabio
Send an email when a Confluence page is updated.Please check my code and give me suggestion based on this I am facing the 404/403 error
import requestsimport json
# Configuration variablesUSER_EMAIL = "" # Email address to receive notificationsCLOUD_ID = "" # Your Confluence cloud IDAPI_TOKEN = "" # Atlassian API tokenSPACE_KEY = ""EMAIL = ""
# Confluence Automation API endpointurl = f"https://api.atlassian.com/automation/public/confluence/{CLOUD_ID}/rest/v1/rule"
# HTTP headersheaders = {"Content-Type": "application/json","Authorization": f"Bearer {API_TOKEN}"}
# Automation rule payloadpayload = {"rule": {"name": "Page Updated Email Notification","description": "Send email when page is updated","state": "ENABLED","trigger": {"component": "TRIGGER","type": "confluence.page.updated","schemaVersion": 1,"value": {}},"components": [{"component": "ACTION","type": "confluence.send.email","schemaVersion": 1,"value": {"to": {"type": "static","value": USER_EMAIL},"subject": {"type": "smart","value": "Page Updated: {{page.title}}"},"body": {"type": "smart","value": ("Page '{{page.title}}' in space '{{page.space.name}}' ""was updated by {{user.displayName}} at {{now}}.\n\n""View page: {{page.url}}")}}}]}}
# Send POST request to create automation ruleresponse = requests.post(url, headers=headers, json=payload)
# Print responseprint(f"Status: {response.status_code}")print(f"Response: {response.text}")
@Fabio Racobaldo _Catworkx_ Can you please look at this issue
It looks like you're new here. Sign in or register to get started.