Gitlab api issue - access files

Hi everyone,

while trying to get the content of my files through Gitlab api i am using

curl -k -s --header “PRIVATE-TOKEN: token” “https://gitlab.example.com/api/v4/projects/5841/repository/files/README.md/raw?ref=master

Working just fine, but some of the files located inside directories, my question is how i get the content of a file located inside directory?

Thanks.

Hey @dolevn0, welcome to the GitLab forum!

Could you please check this part of the API documentation, it should help you to get the data from the file.

Thanks a lot @dsumenkovic it does help me, but there is a chance that i can see all files inside this directory? or i have to specify certain file?

for example we have this tree

Project - Git
Directory - Dir
Files - F1, F2, F3

lets say i understand now how to get content of any of the files if i know their names, but if i do not and i need to find the names first, is this possible?

Sorry to re-open this thread but I have a similar issue however my case is that I want anyone to pull a public file in raw format without needing a key.

Currently when a user is attempting to import the raw file into a smart home hub a error is thrown…

Access to XMLHttpRequest at

‘URL-REMOVED/sgrayban/raspberrypi.monitor/raw/master/Driver/Raspberry-Pi-DHT-Sensor.groovy’ from origin ‘https://192.168.1.114’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Is there a way around this without the need for a access key ?