GitLab REST API Get Submodule file

GitLab REST API Get Submodule file

I’m trying to download files from a submodule in one of my git repos. No matter what I have tried I cannot get it to work. Yes, I can go straight to the submodule repo and get the file the normal way using the normal projects/files API, but it would be a lot more convenient if I didn’t need to know the submodule project ID and branch being used in this particular repo.

Using powershell … the statement below just returns 404
$URI = “
Invoke-WebRequest -Uri $URI -Headers @{ Authorization = “Bearer $token” } -UseBasicParsing


  • shared - is the submodule directory in repo 9999999
  • ref=feature%2Fsome-branch - is the repo 999999 branch I am trying to get the file from

I have also tried the branch of the commit of the submodule. And various escape sequences on the branch name.

Thanks for taking the time to be thorough in your request, it really helps! :blush: