Book Image

GitLab Cookbook

By : Jeroen van Baarsen
Book Image

GitLab Cookbook

By: Jeroen van Baarsen

Overview of this book

Table of Contents (16 chapters)
GitLab Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing issues via the API


One of the most used features in the GitLab API is the creation and listing of issues for a given project. In this recipe, we will take a look at how you can incorporate this into your own workflow.

Getting ready

You need to have your own private_token present, as every call needs this. We will be creating issues for a project, which means that you also need to have at least one project in your GitLab instance.

How to do it…

  1. Let's start by getting the project_id field for which we want to create the issue. You can do this by entering the http://example.com/api/v3/projects?private_token=your_token endpoint in Postman. This will give you a JSON output of all your projects. Just pick one for which you want to create some issues and note the ID.

  2. Now that we have the project_id field, we can create a new issue via the API. The endpoint requires a few necessary fields, which are the project_id field and the title of the issue.

  3. To create the actual issue, you need to enter...