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
About the Author
About the Reviewers

Understanding the API status codes

When you start working with the GitLab API, it's good to be aware of the different status codes that can be returned. In this recipe, I'll explain what each status code means and, if possible, how to solve it. The status codes GitLab uses are equivalent to the HTTP standard status codes.

How it works…

GitLab has the following API status codes:

  • 200 – OK: This means that the GET, PUT, or DELETE request was successful. When you request a resource, it will be returned in JSON format.

  • 201 – Created: This means that the POST request was successful. This status code is only returned when you try to create a new resource. The resource will also be returned to you.

  • 400 – Bad Request: This means you have missed a required attribute for this request. For example, the title for a merge request was not given.

  • 401 – Unauthorized: This means that you are not authenticated. If you don't send a secret token with your request or send an invalid token, this status is returned...