107 lines
3.1 KiB
Markdown
107 lines
3.1 KiB
Markdown
# Issues API reference
|
|
|
|
Base: `https://git.mpm.to/api/v1`
|
|
|
|
## List issues for a repository
|
|
|
|
```bash
|
|
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/issues?type=issues&state=open&limit=50&page=1"
|
|
```
|
|
|
|
Query params:
|
|
- `state`: `open` | `closed` | `all` (default: `open`)
|
|
- `type`: `issues` | `pulls` (use `issues` to exclude PRs)
|
|
- `labels`: comma-separated label names to filter
|
|
- `assignee`: filter by username
|
|
- `milestone`: milestone ID
|
|
- `q`: search keyword
|
|
|
|
Key response fields per issue: `number`, `title`, `body`, `state`, `user.login`, `assignees`, `labels`, `milestone`, `created_at`, `updated_at`, `html_url`.
|
|
|
|
## Get a single issue
|
|
|
|
```bash
|
|
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/issues/{index}"
|
|
```
|
|
|
|
## Create an issue
|
|
|
|
```bash
|
|
curl -s -X POST \
|
|
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"title": "Issue title",
|
|
"body": "Issue description (markdown supported)",
|
|
"assignees": ["username1"],
|
|
"labels": [123],
|
|
"milestone": 1
|
|
}' \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/issues"
|
|
```
|
|
|
|
Note: `labels` takes an array of label IDs (integers), not names. Fetch label IDs first if needed:
|
|
```bash
|
|
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/labels"
|
|
```
|
|
|
|
## Update an issue (edit title, body, state, assignees)
|
|
|
|
```bash
|
|
curl -s -X PATCH \
|
|
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"title": "Updated title",
|
|
"body": "Updated body",
|
|
"state": "closed"
|
|
}' \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/issues/{index}"
|
|
```
|
|
|
|
Use `"state": "closed"` to close an issue, `"state": "open"` to reopen.
|
|
|
|
## Add a comment to an issue
|
|
|
|
```bash
|
|
curl -s -X POST \
|
|
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"body": "Comment text (markdown supported)"}' \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/issues/{index}/comments"
|
|
```
|
|
|
|
## List comments on an issue
|
|
|
|
```bash
|
|
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/issues/{index}/comments"
|
|
```
|
|
|
|
## Add labels to an issue
|
|
|
|
```bash
|
|
curl -s -X POST \
|
|
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"labels": [123, 456]}' \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/issues/{index}/labels"
|
|
```
|
|
|
|
## List all labels for a repo
|
|
|
|
```bash
|
|
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/labels"
|
|
```
|
|
|
|
## List issues across all repos (authenticated user)
|
|
|
|
```bash
|
|
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
|
|
"https://git.mpm.to/api/v1/repos/issues/search?state=open&type=comment&limit=50"
|
|
```
|