@@ -69,7 +69,7 @@ Content-Type: application/octet-stream
69
69
## Get contents
70
70
71
71
```
72
- GET /repos/:username/:reponame/contents/:ref/: path
72
+ GET /repos/:username/:reponame/contents/:path
73
73
```
74
74
75
75
### Parameters
@@ -78,6 +78,36 @@ GET /repos/:username/:reponame/contents/:ref/:path
78
78
| ----| ----| -----------|
79
79
| ` ref ` | ` string ` | The name of the commit/branch/tag. The default is the default branch of the repository, usually is ` master ` .|
80
80
81
+ ### Response if path is empty
82
+
83
+ It's possible for ` :path ` to be empty. If no path is specified the contents at the root of the repository are returned.
84
+
85
+ ```
86
+ Status: 200 OK
87
+ ```
88
+ ``` json
89
+ [
90
+ {
91
+ "type" : " file" ,
92
+ "encoding" : " base64" ,
93
+ "size" : 50 ,
94
+ "name" : " Sum.groovy" ,
95
+ "path" : " src/Sum.groovy" ,
96
+ "content" : " c3RhdGljIGludCBzdW0oaW50IHZhbDEsIHZhbDIpIHsKICAgIHZhbDEgKyB2YWwyCn0=" ,
97
+ "sha" : " 9f221918607d78c1db3f6c6d5afa68a66b1146a8" ,
98
+ "url" : " https://try.gogs.io/api/v1/repos/unknwon/git-module-testrepo/contents/src/Sum.groovy" ,
99
+ "git_url" : " https://try.gogs.io/api/v1/repos/unknwon/git-module-testrepo/git/blobs/9f221918607d78c1db3f6c6d5afa68a66b1146a8" ,
100
+ "html_url" : " https://try.gogs.io/unknwon/git-module-testrepo/src/master/Sum.groovy" ,
101
+ "download_url" : " https://try.gogs.io/unknwon/git-module-testrepo/raw/master/Sum.groovy" ,
102
+ "_links" : {
103
+ "git" : " https://try.gogs.io/api/v1/repos/unknwon/git-module-testrepo/git/blobs/9f221918607d78c1db3f6c6d5afa68a66b1146a8" ,
104
+ "self" : " https://try.gogs.io/api/v1/repos/unknwon/git-module-testrepo/contents/src/Sum.groovy" ,
105
+ "html" : " https://try.gogs.io/unknwon/git-module-testrepo/src/master/Sum.groovy"
106
+ }
107
+ }
108
+ ]
109
+ ```
110
+
81
111
### Response if content is a file
82
112
```
83
113
Status: 200 OK
0 commit comments