Gitlab API 404 on projects/:id endpoint using namespaced path encoding

Hi,

I am using a self-hosted instance of Gitlab 13.0.6.
I am trying to use the Gitlab API to fetch project information.

  • project name is: PROJNAME
  • project belong to: GROUP-NAME (there is a dash in the group name)
  • project visibility is internal
  • I use curl --header "PRIVATE-TOKEN: API_TOKEN" "https://URL/api/v4/QUERY" | jq -C | less -R to send REST queries.
  • The PRIVATE-TOKEN is a token with API permissions, I am an admin of the instance.

Using: curl --header "PRIVATE-TOKEN: API_TOKEN" "https://URL/api/v4/projects/1", I do get JSON information about the project. In particular, I do get the "path_with_namespace": "GROUP-NAME/PROJNAME".

But I can’t use the namespaced path encoding to get the same JSON information (as described here https://docs.gitlab.com/ee/api/README.html#namespaced-path-encoding). I tried:

  • curl --header "PRIVATE-TOKEN: API_TOKEN" "https://URL/api/v4/projects/GROUP-NAME%2FPROJNAME" (percent encoding of the /)
  • curl --header "PRIVATE-TOKEN: API_TOKEN" "https://URL/api/v4/projects/GROUP%2DNAME%2FPROJNAME" (percent encoding of the / and the - in GROUP-NAME)

What am I missing?

Thanks for your time. Best,

1 Like

@daimrod did you ever get any kind of satisfactory resolution to this? It seems I am seeing the same issue.

It worked for me just now. The only thing I had was the URL without the quotes.

curl --header "PRIVATE-TOKEN: my-token" https://gitlab.mydomain.com/api/v4/projects/group%2Fproject