Skip to content

Update an enterprise label

PUT /api/v8/enterprises/{enterprise_id}/label/{label_id}

Call this endpoint to update an enterprise label.

Supported access tokens

  • AtomGit user access tokens

Anonymous access allowed

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
enterprise_id path integer Yes Enterprise ID
label_id path integer Yes Label ID
access_token query string Yes User authorization code

Request Body:

The request body uses application/json and contains the following fields:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "description": "Label name",
      "type": "string"
    },
    "color": {
      "description": "Label color as a 6-digit hexadecimal value prefixed with '#'",
      "type": "string"
    },
    "description": {
      "description": "Label description",
      "type": "string"
    },
    "expires_at": {
      "description": "Label expiration date",
      "type": "string"
    }
  },
  "required": ["name", "description"]
}

Response parameters

Field Type Always returned Nullable Description
id integer Yes No Label ID
name string Yes No Label name
color string Yes No Label color
repository_id integer Yes Yes Repository ID; may be null in the update endpoint
url string Yes Yes Label URL; may be null in the update endpoint
created_at string Yes Yes Creation time; may be null in the update endpoint
updated_at string Yes Yes Update time; may be null in the update endpoint
description string Yes No Label description

Error response

When parameter validation fails, authentication or permission validation fails, or the resource does not exist, the endpoint returns an ApiErrorResp error.

400 Invalid parameters

{
  "error_code": 400,
  "error_code_name": "BAD_REQUEST",
  "error_message": "Update enterprise label, name is required"
}

401 Unauthenticated

{
  "error_code": 401,
  "error_code_name": "UNAUTHORIZED",
  "error_message": "Bad credentials"
}

403 Access forbidden

{
  "error_code": 403,
  "error_code_name": "FORBIDDEN",
  "error_message": "The provided token lacks 'enterprise' scope. Please recreate or update your token with the required scope"
}

404 Resource does not exist

{
  "error_code": 404,
  "error_code_name": "NOT_FOUND",
  "error_message": "not found"
}

HTTP status codes

Status code Description
200 Success (OK)
400 Invalid parameters (Bad Request)
401 Authentication required (Unauthorized)
403 Access forbidden (Forbidden)
404 Resource does not exist (Not Found)
429 Too many requests (Too Many Requests)
500 Internal system error (Internal Server Error)

Request example

Parameter notes

Replace <enterprise_id> with the enterprise ID, <label_id> with the label ID, and <token> with your AtomGit user access token.

cURL

curl -X PUT 'https://api.atomgit.com/api/v8/enterprises/<enterprise_id>/label/<label_id>?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -d '{"name": "bug", "color": "#f00000", "description": "Defect label"}'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v8/enterprises/<enterprise_id>/label/<label_id>?access_token=<token>", {
  method: "PUT",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "bug",
    color: "#f00000",
    description: "Defect label",
  }),
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.put(
    "https://api.atomgit.com/api/v8/enterprises/<enterprise_id>/label/<label_id>",
    params={"access_token": "<token>"},
    json={
        "name": "bug",
        "color": "#f00000",
        "description": "Defect label",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": 1,
  "name": "bug",
  "color": "#f00000",
  "repository_id": null,
  "url": null,
  "created_at": null,
  "updated_at": null,
  "description": "Defect label"
}

Error codes

Error code Description
400 Invalid parameters or the request cannot be parsed
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
403 Access forbidden (missing permission)
404 Request path or resource does not exist
429 Too many requests; rate limit triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc