Search code examples
gitlabgitlab-api

GitLab API Rest filtering issues by milestone_id


I would like to retrieve all the issues from a project which have been assigned to a certain milestone and then apply some filters to them (for instance, update date).

I use the query parameter milestone_id like this:

https://gitlab.itg.es/api/v4/projects/123/issues?state=all&scope=all&milestone=255&per_page=50&sort=asc&pagination=keyset

The result is always this, regardless the value put in milestone_id:

{
    "error": "milestone_id does not have a valid value"
}

I double checked whether the milestone_id value was correct. I tried with different milestone ids, both active and closed, but the result is always the same.

On the other hand, if I use milestone and I place the milestone name, everything works:

https://gitlab.itg.es/api/v4/projects/123/issues?state=all&scope=all&milestone=ficticiouse milestone name&per_page=50&sort=asc&pagination=keyset

Any idea where the problem is?

Thanks in advance.


Solution

  • The milestone_id field is not for the milestone id but for the milestone time status. The admitted values are None, Any, Upcoming and Started (taken from the GitLab API documentation):

    Returns issues assigned to milestones with a given timebox value (None, Any, Upcoming, and Started).