Skip to content

Update issue

PATCH /api/v5/repos/{owner}/issues/{number}

Call this endpoint to update an issue in the specified repository.

Access token support

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address path of the namespace that owns the repository (the address path of an organization or an individual)
number path string Yes The issue number, that is, the ordinal of the issue in this repository
access_token query string Yes User authorization code

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "repo": {
      "description": "Repository path",
      "type": "string"
    },
    "title": {
      "description": "Issue title",
      "type": "string"
    },
    "body": {
      "description": "Issue description",
      "type": "string"
    },
    "state": {
      "description": "Issue state: reopen (open), close (closed)",
      "type": "string",
      "enum": ["reopen", "close"]
    },
    "assignee": {
      "description": "Username of the issue assignee; separate multiple values with commas",
      "type": "string"
    },
    "milestone": {
      "description": "Milestone number",
      "type": "integer"
    },
    "labels": {
      "description": "Comma-separated labels; each name must be 2-20 characters long and contain no special characters, for example: bug,performance",
      "type": "string"
    },
    "security_hole": {
      "description": "Whether this is a private issue (defaults to false)",
      "type": "string",
      "default": "false"
    },
    "status": {
      "description": "Issue status (supported in the enterprise edition); cannot be set together with issue_type",
      "type": "string"
    },
    "issue_severity": {
      "description": "Issue priority (supported in the enterprise edition); cannot be set together with issue_type",
      "type": "string"
    },
    "issue_type": {
      "description": "Issue type (supported in the enterprise edition); cannot be set together with status or priority",
      "type": "string"
    },
    "custom_fields": {
      "description": "Custom field information (supported in the enterprise edition)",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field_name": {
            "description": "Field name",
            "type": "string"
          },
          "field_values": {
            "description": "Array of field values",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  },
  "required": ["repo", "title"]
}

Note: status and issue_severity can be set at the same time, but neither can be set together with issue_type (supported in the enterprise edition).

Response parameters

Field Type Always returned Nullable Description
id integer Yes No Issue ID
html_url string Yes No Web address of the issue
number integer Yes No Issue number
state string Yes No Issue state
title string Yes No Issue title
body string Yes Yes Issue description
user object Yes No Information about the issue creator
assignee object No Yes Information about the issue assignee; may be null
repository object Yes No Information about the repository the issue belongs to
created_at string Yes No Creation time
updated_at string Yes No Update time
finished_at string No Yes Completion time; may be null
labels object[] Yes Yes List of issue labels
stage string Yes Yes Stage
severity string Yes Yes Severity
custom_fields object[] Yes Yes Custom field information (supported in the enterprise edition)

user object

Field Type Always returned Nullable Description
user.avatar_url string Yes Yes Avatar address
user.events_url string No Yes Events address
user.followers_url string No Yes Followers list address
user.following_url string No Yes Following list address
user.gists_url string No Yes Gists list address
user.html_url string Yes No User homepage address
user.id string Yes No User ID
user.login string Yes No Login name
user.member_role string No Yes Member role
user.name string Yes No Name
user.organizations_url string No Yes Organizations list address
user.received_events_url string No Yes Received events list address
user.remark string No Yes Remark
user.repos_url string No Yes Repository list address
user.starred_url string No Yes Starred repositories list address
user.subscriptions_url string No Yes Subscriptions list address
user.type string No Yes User type
user.url string No Yes User address

assignee object

Field Type Always returned Nullable Description
assignee.avatar_url string Yes Yes Avatar address
assignee.events_url string No Yes Events address
assignee.followers_url string No Yes Followers list address
assignee.following_url string No Yes Following list address
assignee.gists_url string No Yes Gists list address
assignee.html_url string Yes No User homepage address
assignee.id string Yes No User ID
assignee.login string Yes No Login name
assignee.member_role string No Yes Member role
assignee.name string Yes No Name
assignee.organizations_url string No Yes Organizations list address
assignee.received_events_url string No Yes Received events list address
assignee.remark string No Yes Remark
assignee.repos_url string No Yes Repository list address
assignee.starred_url string No Yes Starred repositories list address
assignee.subscriptions_url string No Yes Subscriptions list address
assignee.type string No Yes User type
assignee.url string No Yes User address

repository object

Field Type Always returned Nullable Description
repository.id integer Yes No Repository ID
repository.full_name string Yes No Full repository name (owner/repo)
repository.path string Yes No Repository path
repository.name string Yes No Repository name
repository.description string Yes Yes Repository description
repository.created_at string Yes No Repository creation time
repository.updated_at string Yes No Repository update time

labels[] object

Field Type Always returned Nullable Description
labels.id integer Yes No Label ID
labels.name string Yes No Label name
labels.color string Yes No Label color

custom_fields[] object

Field Type Always returned Nullable Description
custom_fields.field_name string Yes No Custom field name
custom_fields.field_type string Yes No Type of the custom field. text_single: single-line text, text_multi: multi-line text, integer: integer, decimal: decimal, date: date, select_single: single-select dropdown, select_multi: multi-select dropdown, member_single: single member, member_multi: multiple members
custom_fields.field_visibility string Yes No Visibility. 0: visible to administrators only; 1: visible to everyone
custom_fields.field_values string[] Yes No Values of the custom field

Error responses

Callers need to know the shape of an error response to write error handling. The following lists only the generic failure scenarios this endpoint may return; the actual error field names returned by the backend take precedence.

400 Parameter error

{
  "error": "invalid_request",
  "message": "The title parameter cannot be empty",
  "field": "title"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication (Requires authentication)
403 Forbidden (Forbidden)
404 Resource not found (Not found)

Request example

Parameter notes

Replace <owner> with the address path of the namespace that owns the repository (the address path of an organization or an individual); replace <number> with the issue number; replace <token> with your AtomGit user access token; replace <username> with the username of the issue assignee.

cURL

curl -X PATCH 'https://api.atomgit.com/api/v5/repos/<owner>/issues/<number>?access_token=<token>'   -H 'Accept: application/json'   -H 'Content-Type: application/json'   -d '{
  "repo": "test01",
  "title": "Fix login timeout issue",
  "body": "Update the issue description",
  "state": "close",
  "assignee": "<username>",
  "labels": "bug,performance"
}'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/issues/<number>?access_token=<token>",
  {
    method: "PATCH",
    headers: {
      "Accept": "application/json",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      repo: "test01",
      title: "Fix login timeout issue",
      body: "Update the issue description",
      state: "close",
      assignee: "<username>",
      labels: "bug,performance",
    }),
  }
);

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

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

Python

import requests

resp = requests.patch(
    "https://api.atomgit.com/api/v5/repos/<owner>/issues/<number>",
    params={"access_token": "<token>"},
    json={
        "repo": "test01",
        "title": "Fix login timeout issue",
        "body": "Update the issue description",
        "state": "close",
        "assignee": "<username>",
        "labels": "bug,performance",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": 152467,
  "html_url": "https://api.atomgit.com/dengmengmian/test01/issues/14",
  "number": 14,
  "state": "closed",
  "title": "Fix login timeout issue",
  "body": "Updated issue description",
  "user": {
    "avatar_url": "https://api.atomgit.com/avatar/example.png",
    "events_url": null,
    "followers_url": null,
    "following_url": null,
    "gists_url": null,
    "html_url": "https://api.atomgit.com/dengmengmian",
    "id": "661ce4eab470b1430d456154",
    "login": "dengmengmian",
    "member_role": null,
    "name": "Ma Fan_",
    "organizations_url": null,
    "received_events_url": null,
    "remark": null,
    "repos_url": null,
    "starred_url": null,
    "subscriptions_url": null,
    "type": null,
    "url": null
  },
  "assignee": {
    "avatar_url": "https://api.atomgit.com/avatar/example.png",
    "events_url": null,
    "followers_url": null,
    "following_url": null,
    "gists_url": null,
    "html_url": "https://api.atomgit.com/dengmengmian",
    "id": "661ce4eab470b1430d456154",
    "login": "dengmengmian",
    "member_role": null,
    "name": "Ma Fan_",
    "organizations_url": null,
    "received_events_url": null,
    "remark": null,
    "repos_url": null,
    "starred_url": null,
    "subscriptions_url": null,
    "type": null,
    "url": null
  },
  "repository": {
    "id": 152467,
    "full_name": "dengmengmian/test01",
    "path": "test01",
    "name": "test01",
    "description": "",
    "created_at": "2024-04-16T14:38:43.464+08:00",
    "updated_at": "2024-04-18T18:27:21.955+08:00"
  },
  "created_at": "2024-04-16T14:38:43.464+08:00",
  "updated_at": "2024-04-18T18:27:21.955+08:00",
  "finished_at": "2024-04-16T14:49:45.166+08:00",
  "labels": [
    {
      "id": 382389,
      "name": "bug",
      "color": "#428BCA"
    },
    {
      "id": 382388,
      "name": "performance",
      "color": "#428BCA"
    }
  ],
  "stage": "New",
  "severity": "Major",
  "custom_fields": [
    {
      "field_name": "priority",
      "field_type": "select_single",
      "field_visibility": "1",
      "field_values": ["High"]
    }
  ]
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credential)
400 Invalid parameters or unparsable request
404 Request path does not exist
405 Unsupported request method
429 Too many requests; rate limit triggered
500 Internal server error

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