aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-17 11:11:25 +0200
committerChocobozzz <me@florianbigard.com>2018-04-17 11:12:37 +0200
commitc0c7416a233d1bf1ed197b8f383aca74bc27c3f0 (patch)
tree1af5164085e8b1357de84ef76ea70c829e51a4d9 /support/doc/api
parent7b87d2d5141d0eb48db2a3fd162208d6a79b2035 (diff)
downloadPeerTube-c0c7416a233d1bf1ed197b8f383aca74bc27c3f0.tar.gz
PeerTube-c0c7416a233d1bf1ed197b8f383aca74bc27c3f0.tar.zst
PeerTube-c0c7416a233d1bf1ed197b8f383aca74bc27c3f0.zip
Add rest api quickstart
Diffstat (limited to 'support/doc/api')
-rw-r--r--support/doc/api/quickstart.md47
1 files changed, 47 insertions, 0 deletions
diff --git a/support/doc/api/quickstart.md b/support/doc/api/quickstart.md
new file mode 100644
index 000000000..5ebcd4f47
--- /dev/null
+++ b/support/doc/api/quickstart.md
@@ -0,0 +1,47 @@
1# REST API quick start
2
3## Authentication
4
5### Get client
6
7Some endpoints need authentication. We use OAuth 2.0 so first fetch the client tokens:
8
9```
10$ curl https://peertube.example.com/api/v1/oauth-clients/local
11```
12
13Response example:
14
15```
16{
17 "client_id": "v1ikx5hnfop4mdpnci8nsqh93c45rldf",
18 "client_secret": "AjWiOapPltI6EnsWQwlFarRtLh4u8tDt"
19}
20```
21
22### Get user token
23
24Now you can fetch the user token:
25
26```
27$ curl -X POST \
28 -d "client_id=v1ikx5hnfop4mdpnci8nsqh93c45rldf&client_secret=AjWiOapPltI6EnsWQwlFarRtLh4u8tDt&grant_type=password&response_type=code&username=your_user&password=your_password" \
29 https://peertube.example.com/api/v1/users/token
30```
31
32Response example:
33
34```
35{
36 "access_token": "90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0",
37 "token_type": "Bearer",
38 "expires_in": 14399,
39 "refresh_token": "2e0d675df9fc96d2e4ec8a3ebbbf45eca9137bb7"
40}
41```
42
43Just use the `access_token` in the `Authorization` header:
44
45```
46$ curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https://peertube.example.com/api/v1/jobs/complete
47``` \ No newline at end of file