Skip to content
Advertisement

How to use `not` condition in the gitlab api issue query

I am trying to read the list of open issues title which doesn’t have label resolved. For that I am referring the API documentation (https://docs.gitlab.com/ee/api/issues.html) which mentions NOT but I couldn’t able to get the NOT to work.

The following python script I have tried so far to read the list of issues now I am not able to find how to use NOT to filter the issue which doesn’t have resolved label.

JavaScript

Advertisement

Answer

From Gitlab issues api documentation, not is of type Hash. It’s a special type documented here

For example to exclude the labels Category:DAST and devops::secure, and to exclude the milestone 13.11, you would use the following parameters:

JavaScript

api example: https://gitlab.com/api/v4/issues?scope=all&state=opened&assignee_username=derekferguson&not[labels]=Category:DAST,devops::secure&not[milestone]=13.11

Using gitlab python module, you would need to pass some extra parameters by adding more keyword arguments:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement