How to get count of attachment via rest API?

YongDeokAhn
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 13, 2020

I wonder How to get count of attachment via rest API.

1 answer

0 votes
Pavel Potcheptsov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2020
# echo -e "\nNumber of attachment is" && curl -s -n http://localhost:8090/rest/api/content/26477449/child/attachment | python -mjson.tool | tail -3 | head -1 | tr -dc '0-9' && echo

Number of attachment is
4

# echo -e "\nNumber of attachment is" && curl -s -n http://localhost:8090/rest/api/content/11048040/child/attachment | python -mjson.tool | tail -3 | head -1 | tr -dc '0-9' && echo

Number of attachment is
13

Screenshot1.pngScreenshot2.png

Steffen Müller March 2, 2021

Hey Pavel, your code only works if there are max 50 attachments (or what you passed as a limit query parameter). The Rest endpoint you used only returns how many attachments it returned, not how many attachments exist.

Pavel Potcheptsov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2021

Want me to fix that?

I've to find page with more than 50 files first)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events