Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Improve REST api getting started guide

Chocobozzzae362aae2042
diff --git a/packages/tests/src/api/check-params/live.ts b/packages/tests/src/api/check-params/live.ts
index 6616737756..ed195dd70a 100644
--- a/packages/tests/src/api/check-params/live.ts
+++ b/packages/tests/src/api/check-params/live.ts
@@ -603,6 +603,8 @@ describe('Test video lives API validator', function () {
await command.update({ videoId: video.id, fields: { permanentLive: false }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await stopFfmpeg(ffmpegCommand)
+
+ await command.waitUntilWaiting({ videoId: video.id })
})
it('Should fail to change live privacy if it has already started', async function () {
diff --git a/support/doc/api/quickstart.md b/support/doc/api/quickstart.md
index 1b9e40e2ad..da1adc8a24 100644
--- a/support/doc/api/quickstart.md
+++ b/support/doc/api/quickstart.md
@@ -14,10 +14,20 @@ There are several ways to know if a website uses the PeerTube software:
Some endpoints need authentication. We use OAuth 2.0 so first fetch the client tokens:
-```bash
+::: code-group
+
+```bash [Curl]
curl https://peertube.example.com/api/v1/oauth-clients/local
```
+```js [JS]
+const { client_id, client_secret } = await fetch('https://peertube.example.com/api/v1/oauth-clients/local', {
+ headers: { 'Content-Type': 'application/json' }
+}).then(res => res.json())
+```
+
+:::
+
Response example:
```json
@@ -31,12 +41,29 @@ Response example:
Now you can fetch the user token:
-```bash
+::: code-group
+
+```bash [Curl]
curl -X POST \
-d "client_id=v1ikx5hnfop4mdpnci8nsqh93c45rldf&client_secret=AjWiOapPltI6EnsWQwlFarRtLh4u8tDt&grant_type=password&response_type=code&username=your_user&password=your_password" \
https://peertube.example.com/api/v1/users/token
```
+```js [JS]
+const { access_token } = await fetch('https://peertube.example.com/api/v1/users/token', {
+ contentType: 'application/x-www-form-urlencoded',
+ method: 'POST',
+ body: new URLSearchParams({
+ client_id: '...',
+ client_secret: '...',
+ username: '...',
+ password: '...',
+ grant_type: 'password'
+ })
+}).then(res => res.json())
+```
+:::
+
Response example:
```json