Skip to content

API call to get the ID of a projects latest pipeline

Description

My group is wanting to write a build board that displays the status of all of our builds on a web page. We would like to use the GitLab API to query the pipelines to know when a new build has finished, but as far as I can tell the current GitLab API only provides functionality to get the list of all of the pipelines(which could grow to be a great deal of information) or the information from a specific build ID. The build board, however, can't know what the ID of each repo's next build will be.

Proposal

An API call to get the pipeline ID of the most recent build. Something like GET /projects/:id/pipelines/latest

or for example,

curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/pipeline/latest"

an example response is simply,

{
  "id": 133
}