Milestone API Documentation

1. Get All Milestones of a Repository

Request

GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones

ParameterDescriptionTypeData Type
access_tokenpersonal access tokenquerystring
owner*Repository Ownership Path (Company, Organization, or Personal Path)pathstring
repo*Repository Path(path)pathstring
statestate: open, closed, all。Default: openquerystring
sortsort: due_onquerystring
directionasc/desc, Default: ascquerystring
pageCurrent Page Numberqueryint
per_pageItems Per Page, Maximum 100queryint

Response

[
    {
        "closed_issues": 0,
        "created_at": "2024-10-08T10:58:16+08:00",
        "description": "你好中国",
        "due_on": "2024-11-08",
        "number": 4914,
        "open_issues": 0,
        "repository_id": 4066481,
        "state": "active",
        "title": "你好中国",
        "updated_at": "2024-10-08T10:58:16+08:00",
        "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
    }
]

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones?state=open&sort=due_on&direction=asc&page=1&per_page=20&access_token=xxxx'

2. Get a Specific Milestone of a Repository

Request

GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones/{number}

ParameterDescriptionTypeData Type
access_tokenpersonal access tokenquerystring
owner*Repository Ownership Path (Company, Organization, or Personal Path)pathstring
repo*Repository Path(path)pathstring
number*Milestone ID (number)pathint

Response

{
    "closed_issues": 0,
    "created_at": "2024-10-08T10:58:16+08:00",
    "description": "你好中国",
    "due_on": "2024-11-08",
    "number": 4914,
    "open_issues": 0,
    "repository_id": 4066481,
    "state": "active",
    "title": "你好中国",
    "updated_at": "2024-10-08T10:58:16+08:00",
    "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
}

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones/4914?access_token=xxxx'

3. Delete a Specific Milestone of a Repository

Request

DELETE https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones/{number}

ParameterDescriptionTypeData Type
access_tokenpersonal access tokenquerystring
owner*Repository Ownership Path (Company, Organization, or Personal Path)pathstring
repo*Repository Path(path)pathstring
number*Milestone ID (number)pathint

Response

Demo

curl --location -g --request DELETE 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones/4914?access_token=xxxx'

4. Update a Milestone of a Repository

Request

PATCH https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones/{number}

ParameterDescriptionTypeData Type
access_tokenpersonal access tokenquerystring
owner*Repository Ownership Path (Company, Organization, or Personal Path)pathstring
repo*Repository Path(path)pathstring
number*Milestone ID (number)pathint
title*Milestone Namebodystring
statestate: open, closed, all。Default: openbodystring
descriptionMilestone Descriptionbodystring
due_on*Milestone due datebodystring

Response

{
    "closed_issues": 0,
    "created_at": "2024-10-08T10:58:16+08:00",
    "description": "你好中国",
    "due_on": "2024-11-08",
    "number": 4914,
    "open_issues": 0,
    "repository_id": 4066481,
    "state": "active",
    "title": "你好中国",
    "updated_at": "2024-10-08T10:58:16+08:00",
    "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
}

Demo

curl --location -g --request PATCH 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones/4914?access_token=xxxx' \
--data-raw '{
    "title": "title",
    "due_on": "2025-01-01"
}'

5. Create a Milestone for a Repository

Request

POST https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones

ParameterDescriptionTypeData Type
access_tokenpersonal access tokenquerystring
owner*Repository Ownership Path (Company, Organization, or Personal Path)pathstring
repo*Repository Path(path)pathstring
title*Milestone Namebodystring
descriptionMilestone Descriptionbodystring
due_on*Milestone due datebodystring

Response

{
    "closed_issues": 0,
    "created_at": "2024-10-08T10:58:16+08:00",
    "description": "你好中国",
    "due_on": "2024-11-08",
    "number": 4914,
    "open_issues": 0,
    "repository_id": 4066481,
    "state": "active",
    "title": "你好中国",
    "updated_at": "2024-10-08T10:58:16+08:00",
    "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
}

Demo

curl --location -g --request POST 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones?access_token=xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "title": "title",
    "due_on": "2025-01-01"
}'