Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 12fa5a7

Browse files
committed
Update
1 parent 784b8c6 commit 12fa5a7

File tree

2 files changed

+98
-4
lines changed

2 files changed

+98
-4
lines changed

‎README.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ This is a set of documents which describes Gogs REST API v1 usage, since it's st
88

99
If you have any questions or concern, please [file an issue](https://github.com/gogits/go-gogs-client/issues/new). :blush:
1010

11+
## TOC
12+
13+
- [Repositories](Repositories)
14+
- [Commits](Repositories/Commits.md)
15+
1116
## Installation
1217

1318
The API is preinstalled with the base Gogs deployment. See [current version](#current-version) and [API source code](https://github.com/gogs/gogs/tree/master/routes/api) for more details.
@@ -28,10 +33,11 @@ server: Caddy
2833
content-length: 175
2934
```
3035

31-
All timestamps return in ISO 8601 format:
36+
All timestamps return in RFC3339 format:
3237

3338
```
3439
YYYY-MM-DDTHH:MM:SSZ
40+
2006年01月02日T15:04:05Z07:00
3541
```
3642

3743
## Authentication
@@ -55,9 +61,37 @@ $ curl -H "Authorization: token {ACCESS_TOKEN}" https://try.gogs.io/api/v1/user/
5561
$ curl https://try.gogs.io/api/v1/user/repos?token={ACCESS_TOKEN}
5662
```
5763

58-
## Parameters
64+
## Pagination
65+
66+
You can specify further pages with the `?page` parameter.
67+
68+
```
69+
curl https://try.gogs.io/api/v1/repos/unknwon/hello/issues?page=1
70+
```
71+
72+
Note that page numbering is 1-based and that omitting the `?page` parameter will return the first page.
73+
74+
### Link header
75+
76+
The [Link header](http://tools.ietf.org/html/rfc5988) includes pagination information:
77+
78+
```
79+
Link: <https://try.gogs.io/api/v1/repos/unknwon/hello/issues?page=3>; rel="next",
80+
<https://try.gogs.io/api/v1/repos/unknwon/hello/issues?page=50>; rel="last"
81+
```
82+
83+
The example includes a line break for readability.
84+
85+
This Link response header contains one or more Hypermedia link relations, some of which may require expansion as URI templates.
86+
87+
The possible rel values are:
5988

60-
Parameters of all requests use POST method can be passed through a normal HTML form or JSON data, but sending JSON is recommended.
89+
|Name|Description|
90+
|----|-----------|
91+
|`next`|The link relation for the immediate next page of results.|
92+
|`last`|The link relation for the last page of results.|
93+
|`first`|The link relation for the first page of results.|
94+
|`prev`|The link relation for the immediate previous page of results.|
6195

6296
## Clients
6397

@@ -66,4 +100,4 @@ Parameters of all requests use POST method can be passed through a normal HTML f
66100

67101
## Notes
68102

69-
- The style of documentation is heavily influenced by [GitHub Developer](https://developer.github.com/).
103+
- The style of documentation is heavily influenced by [GitHub Developer](https://developer.github.com/).

‎Repositories/Commits.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Commits
2+
3+
## Get a single commit
4+
5+
```
6+
GET /repos/:username/:reponame/commits/:sha
7+
```
8+
9+
### Response
10+
11+
```
12+
Status: 200 OK
13+
```
14+
```json
15+
{
16+
"url": "https://try.gogs.io/api/v1/repos/unknwon/demo/commits/dc20792485ffd49b0bca49f90a8d44a16241b84a",
17+
"sha": "dc20792485ffd49b0bca49f90a8d44a16241b84a",
18+
"html_url": "https://try.gogs.io/unknwon/demo/commits/dc20792485ffd49b0bca49f90a8d44a16241b84a",
19+
"commit": {
20+
"url": "https://try.gogs.io/api/v1/repos/unknwon/demo/commits/dc20792485ffd49b0bca49f90a8d44a16241b84a",
21+
"author": {
22+
"name": "unknwon",
23+
"email": "u@gogs.io",
24+
"date": "2018年12月10日T23:51:52-05:00"
25+
},
26+
"committer": {
27+
"name": "unknwon",
28+
"email": "u@gogs.io",
29+
"date": "2018年12月10日T23:51:52-05:00"
30+
},
31+
"message": "Update 'README.md'",
32+
"tree": {
33+
"url": "https://try.gogs.io/api/v1/repos/unknwon/demo/tree/dc20792485ffd49b0bca49f90a8d44a16241b84a",
34+
"sha": "dc20792485ffd49b0bca49f90a8d44a16241b84a"
35+
}
36+
},
37+
"author": {
38+
"id": 1,
39+
"username": "unknwon",
40+
"login": "unknwon",
41+
"full_name": "",
42+
"email": "u@gogs.io",
43+
"avatar_url": "https://secure.gravatar.com/avatar/d8b2871cdac01b57bbda23716cc03b96"
44+
},
45+
"committer": {
46+
"id": 1,
47+
"username": "unknwon",
48+
"login": "unknwon",
49+
"full_name": "",
50+
"email": "u@gogs.io",
51+
"avatar_url": "https://secure.gravatar.com/avatar/d8b2871cdac01b57bbda23716cc03b96"
52+
},
53+
"parents": [
54+
{
55+
"url": "https://try.gogs.io/api/v1/unknwon/demo/commits/9227a50146b3fd815fe864af99b984c77d06326a",
56+
"sha": "9227a50146b3fd815fe864af99b984c77d06326a"
57+
}
58+
]
59+
}
60+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /