Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I find the project ID for the GitLab API?

I use GitLab on their servers. I would like to download my latest built artifacts (build via GitLab CI) via the API like this:

curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.com/api/v3/projects/1/builds/8/artifacts" 

Where do I find this project ID? Or is this way of using the API not intended for hosted GitLab projects?

like image 766
Hubert Ströbitzer Avatar asked Sep 18 '16 16:09

Hubert Ströbitzer


People also ask

How do I find my GitHub project ID?

To find the project number, look at the project URL. For example, https://github.com/orgs/octo-org/projects/5 has a project number of 5. You can also find the node ID of all projects in your organization.

How do I find my GitLab API key?

To locate your personal GitLab API key, first navigate to the GitLab User Settings from the main menu. Then click on Access Tokens in the left side menu. Give a descriptive name for your token, select the “api” scope and finally click on the Create personal access token button.

Where is my GitLab API URL?

If you're a GitLab.com user, the base URL is https://gitlab.com . If you're hosting your own GitLab instance, the base URL depends on your domain configuration so you may need to consult your GitLab admin in case you're unsure (although it's ok to use a trial and error too.


1 Answers

I just found out an even easier way to get the project id: just see the HTML content of the gitlab page hosting your project. There is an input with a field called project_id, e.g:

<input type="hidden" name="project_id" id="project_id" value="335" /> 
like image 185
codependent Avatar answered Sep 18 '22 13:09

codependent