Cannot pass multiple query string paramters to GitLab API


#1

I have run into the following issue when using the GitLab API (v4) for a GET tree request:

When attempting to use multiple query string parameters, only the first one gets processed. So for example if I say

curl --request GET --header 'PRIVATE-TOKEN: ${token}' https://my.self.hosted.gitlab/api/v4/projects/${myProject}/repository/tree?ref=mybranch&path=root/sub/sub

it successfully looks into mybranch, but path=root/sub/sub is ignored and only the results for the root directory are returned


#2

Hi,
I am having the same trouble with multiple parameters here, using Gitlab Community Edition [11.4.9].
I need to access a raw file, just by providing an URI string. Theoretically it could be possible, using a query string with two parameters : ref and private_token, but apparently only the first query parameter is supported :

If I put the private_token first, eg:

curl https://mygitlab.domain/api/v4/projects/<project>/repository/files/<path>/raw?private_token=<token>&ref=master

I get :

{"error":"ref is missing, ref is empty"}

If I put the ref=master first, eg:

curl https://mygitlab.domain/api/v4/projects/<project>/repository/files/<path>/raw?ref=master&private_token=<token>

I get:

{"message":"404 Project Not Found"}

Only if I put the token into a HTTP header :

curl  --header 'PRIVATE-TOKEN: <token>' https://mygitlab.domain/api/v4/projects/<project>/repository/files/<path>/raw?ref=master

It works. But this is not acceptable because I can only provide a simple string URI (here I only use curl for debugging purpose).

Using a previous Gitlab version, before my sysadmin upgraded it, it was possible to have a URI like :

https://mygitlab.domain/<project>/raw/master/<path>?private_token=<token>

And it was working fine, but now this syntax seems not to be supported anymore, and I cannot find any working alternatives.

Any help would be greatly appreciated.

Thanks