Skip to content

Commit 0ad0190

Browse files
authored
Update curl usage in API docs (#21071)
1 parent 8080e23 commit 0ad0190

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/content/doc/developers/api-usage.en-us.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Note that `/users/:name/tokens` is a special endpoint and requires you
4949
to authenticate using `BasicAuth` and a password, as follows:
5050

5151
```sh
52-
$ curl -XPOST -H "Content-Type: application/json" -k -d '{"name":"test"}' -u username:password https://gitea.your.host/api/v1/users/<username>/tokens
52+
$ curl -H "Content-Type: application/json" -k -d '{"name":"test"}' -u username:password https://gitea.your.host/api/v1/users/<username>/tokens
5353
{"id":1,"name":"test","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d"}
5454
```
5555

@@ -58,7 +58,7 @@ plain-text. It will not be displayed when listing tokens with a `GET`
5858
request; e.g.
5959

6060
```sh
61-
$ curl --request GET --url https://yourusername:[email protected]/api/v1/users/<username>/tokens
61+
$ curl --url https://yourusername:[email protected]/api/v1/users/<username>/tokens
6262
[{"name":"test","sha1":"","token_last_eight:"........":},{"name":"dev","sha1":"","token_last_eight":"........"}]
6363
```
6464
@@ -70,7 +70,7 @@ is where you'd place the code from your authenticator.
7070
Here is how the request would look like in curl:
7171
7272
```sh
73-
$ curl -H "X-Gitea-OTP: 123456" --request GET --url https://yourusername:[email protected]/api/v1/users/yourusername/tokens
73+
$ curl -H "X-Gitea-OTP: 123456" --url https://yourusername:[email protected]/api/v1/users/yourusername/tokens
7474
```
7575
7676
You can also create an API key token via your Gitea installation's web
@@ -96,7 +96,7 @@ Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
9696
In a `curl` command, for instance, this would look like:
9797
9898
```sh
99-
curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
99+
curl "http://localhost:4000/api/v1/repos/test1/test1/issues" \
100100
-H "accept: application/json" \
101101
-H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \
102102
-H "Content-Type: application/json" -d "{ \"body\": \"testing\", \"title\": \"test 20\"}" -i

docs/content/doc/developers/api-usage.zh-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
4646
`curl` 命令为例,它会以如下形式携带在请求中:
4747

4848
```
49-
curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
49+
curl "http://localhost:4000/api/v1/repos/test1/test1/issues" \
5050
-H "accept: application/json" \
5151
-H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \
5252
-H "Content-Type: application/json" -d "{ \"body\": \"testing\", \"title\": \"test 20\"}" -i
@@ -62,7 +62,7 @@ curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
6262
### 使用 Basic authentication 认证:
6363

6464
```
65-
$ curl --request GET --url https://yourusername:[email protected]/api/v1/users/yourusername/tokens
65+
$ curl --url https://yourusername:[email protected]/api/v1/users/yourusername/tokens
6666
[{"name":"test","sha1":"..."},{"name":"dev","sha1":"..."}]
6767
```
6868

0 commit comments

Comments
 (0)