Skip to content

/download/attachments/{id}/{id} internal API deprecated and no more working #1640

@gisab

Description

@gisab

The API changes https://developer.atlassian.com/cloud/confluence/changelog/#CHANGE-3007 are not reflected in the SDK.

The confluence.download_attachments_from_page(pageid, filename=filename, to_memory=True) hit internally the confluence cloud API /download/attachments/{id}/{id} which has been deprecated since Jan 26 and now no more working; the call return 401 Unauthorised.

The workaround is to call a custom attachment downloa which hit an url like: /wiki/rest/api/content/{id}/child/attachment/att{id}/download
Note that this URL does not work in a browser.

def custom_download_attachments_from_page(self, page_id, filename):
attachments = self.get_attachments_from_content(page_id)
rest_api_url = attachments["_links"]["self"]

for att in attachments["results"]:
    if att["title"] == filename:
        attachment_id = att['id']
        url = rest_api_url + f"/{attachment_id}/download"
        response = self.get(
            url,
            not_json_response=True,
            absolute=True,
        )
        return response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions