where do I find the project id for the gitlab api?

Hubert Ströbitzer picture Hubert Ströbitzer · Sep 18, 2016 · Viewed 49.3k times · Source

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?

BW Hubert

Answer

codependent picture codependent · Aug 4, 2017

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" />