From 50339e1d0a82439476f7604566a933f18c6afc3f Mon Sep 17 00:00:00 2001 From: neyrat-salvator Date: Tue, 25 Aug 2026 15:51:59 +0300 Subject: [PATCH] Add again move_or_update_attachment_json_rpc to __init__.py This method applies to change attachment name at the selected confluence page --- atlassian/confluence/server/__init__.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/atlassian/confluence/server/__init__.py b/atlassian/confluence/server/__init__.py index 3626e3017..2a660dab2 100644 --- a/atlassian/confluence/server/__init__.py +++ b/atlassian/confluence/server/__init__.py @@ -1370,6 +1370,29 @@ def delete_attachment_by_id(self, attachment_id, version): url = f"rest/experimental/content/{attachment_id}/version/{version}" return self.delete(url) + def move_or_update_attachment_json_rpc(self, originalContentId: str, originalName: str, newContentEntityId: str=None, newName: str=None): + """ + Move attachment from source confluence page to destination confluence page optionally with new title + OR + Just update attachment from source confluence page with new title + via JSON-RPC. + :param str originalContentId: confluence source page id + :param str newContentEntityId: confluence destination page id + :param str originalName: source attachment title + :param str newName: new attachment title + """ + if self.api_version == "cloud" or self.cloud: + return {} + url = "rpc/json-rpc/confluenceservice-v2" + data = { + "jsonrpc": "2.0", + "method": "moveAttachment", + "id": 9, + "params": [originalContentId, originalName, newContentEntityId, newName] + } + + return self.post(url, data=data).get("result") or {} + def remove_page_attachment_keep_version(self, page_id, filename, keep_last_versions): """ Keep last versions