Is there a way to list all the files in the repository using the API.

The Sailor
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!
March 14, 2018

Hello,
We would like to analyze the repository using your API, our goal is to list all the folders and files in the repository limited by the folder depth of 4.  

From what I have read it seems that this API 

/2.0/repositories/{username}/{repo_slug}/src/{node}/{path} 

Can give me the sources but it doesn't have a recursion option so I need to fetch each folder in a different request and to analyze , it  is there a different API that I can use? 

If there is no other API, is there an option to request for several sources at the same time? So we will be able to reduce the amount of requests.

Thank you.  

1 answer

1 vote
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 15, 2019

Hi @The Sailor,

you were searching at the right place. The endpoint you mentioned supports recursion if you specify additionally the max_depth parameter and indicate how many levels you want to have.

You can then page through the results as described in the docs. Maybe this response is too late for you, but I hope it at least helps someone else.

Cheers,
Matthias.

Altaf B
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!
August 10, 2019

Hello Mathias,

 

The link you shared is not clear on how to use the parameter. Is this to be passed as query string?

Also, what would be the value of node?

 

Thanks,

Altaf B.

Like Sam Crudge likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events