Forums

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

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 edited
# 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.png Screenshot2.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
Product Admin
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events