Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

CONF: how to search for content where a specific attachment (by id) is used?

Stefan Baader
Contributor
July 24, 2019

I want to check via REST API if an attachment is used in other pages.

/rest/api/search?cql=siteSearch~'Hydrangeas.jpg' & includeArchivedSpaces=true & type IN (blogpost, page)

works for the file name "Hydrangeas.jpg" of the attachment. But that file name might be another attachment with the identical name on another page.

But regarding the "data-image-src" attribute of an embedded image (f.e. "/context/download/attachments/104956981/Hydrangeas.jpg?version=1&modificationDate=1563972519812&api=v2") I can't use this.

F.e. this will not work:

https://<removed>/rest/api/search?cql=siteSearch~104956981&includeArchivedSpaces=true&type IN (blogpost, page)

 

1 answer

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 26, 2019

Hello Stefan,

I’ve reviewed your notes and followed the steps you took along with completing a GET call on a page to get attachments. What I found was the file is always referred to as the filename of the attachment per the parent page it’s attached to. The ID you refer to seems to be the parent page the attachment is associated with. With this said, you’ll need to use the filename and the parent page to locate a file to avoid any attachments with similar names.

If I’ve missed something within your steps, please do let me know and I’ll recheck. I would be interested to know where you’re getting the ID to search for the attachment from.

Regards,
Stephen Sifers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events