0
API to download attachments
We have some discussions that have attachments in different posts, but all are relevant. I'm trying to consolidate the discussion and attachments in a summary.
Is there an API endpoint that would let me pull attachments for specific posts?
1 reply
-
Hi ,
You can use the Posts API to get the file attachment information for posts.
For a list of posts, use /api/2/posts. For a specific post, use /api/2/posts/{postKey} and include media fields such as:
fields=postKey,title,media,media.mediaKey,media.fileName,media.fileExtFile attachment info is returned in media.data[], so this works for posts with one file or multiple files. For each item in media.data[], you can construct the file download link as:
https://{your-domain}/media/download/{mediaKey}/{urlencoded fileName}If the community is private, opening that link still requires the user to be signed in with permission to access the file.