2

I want to use GitLab API to get the contents of my project. The URL is like this:

https://gitlab.com/api/v4/projects/:id/repository/files/:file_path?private-token=xxxxx

I have already created the private token, but I can not find my project's ID.

Looking for reply!

juzraai
  • 4,835
  • 8
  • 26
  • 41
  • Possible duplicate of [where do I find the project id for the gitlab api?](https://stackoverflow.com/questions/39559689/where-do-i-find-the-project-id-for-the-gitlab-api) – qtopierw Oct 31 '18 at 04:06

2 Answers2

1

You can use the following to get the project's ID, inserting the project path which should be URL encoded.

Example:

https://gitlab.com/api/v4/projects/[project path URL encoded]
Steve Mulvihill
  • 680
  • 5
  • 13
1

Since GitLab 11.2 (August 22nd, 2018), it is easier to check out one's project ID, thanks to Tuğçe Nur Taş.

See "Show project ID on project overview":

GitLab projects are associated with an auto-generated, unique project ID upon creation. This information is available in the General project settings and via our API.

With this release, we have added the project ID to the project overview page, so that users without Maintainer permissions also have access to this ID when needed.

https://about.gitlab.com/images/11_2/project-id-on-overview.png

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283