Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions atlassian/confluence/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading