X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=support%2Fdoc%2Fapi%2Fquickstart.md;h=6777459698617359be5c9fcbc11416a1dfd73063;hb=b036eb057efda11259400d3d204c1e48c9755de8;hp=5ebcd4f473d3f3f385d0b9858bf5993203f7303c;hpb=c0c7416a233d1bf1ed197b8f383aca74bc27c3f0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/support/doc/api/quickstart.md b/support/doc/api/quickstart.md index 5ebcd4f47..677745969 100644 --- a/support/doc/api/quickstart.md +++ b/support/doc/api/quickstart.md @@ -6,13 +6,13 @@ Some endpoints need authentication. We use OAuth 2.0 so first fetch the client tokens: -``` +```bash $ curl https://peertube.example.com/api/v1/oauth-clients/local ``` Response example: -``` +```json { "client_id": "v1ikx5hnfop4mdpnci8nsqh93c45rldf", "client_secret": "AjWiOapPltI6EnsWQwlFarRtLh4u8tDt" @@ -23,7 +23,7 @@ Response example: Now you can fetch the user token: -``` +```bash $ 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 @@ -31,7 +31,7 @@ $ curl -X POST \ Response example: -``` +```json { "access_token": "90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0", "token_type": "Bearer", @@ -42,6 +42,23 @@ Response example: Just use the `access_token` in the `Authorization` header: +```bash +$ curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https://peertube.example.com/api/v1/jobs/completed +``` + + +## List videos + +```bash +$ curl https://peertube.example.com/api/v1/videos ``` -$ curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https://peertube.example.com/api/v1/jobs/complete -``` \ No newline at end of file + +## Libraries + +[Convenience libraries](https://framagit.org/framasoft/peertube/clients) are generated automatically from the [OpenAPI specification](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/api/openapi.yaml) for the following languages: + +- [python](https://framagit.org/framasoft/peertube/clients/python) +- [go](https://framagit.org/framasoft/peertube/clients/go) +- [kotlin](https://framagit.org/framasoft/peertube/clients/kotlin) + +Other [languages supported by the OpenAPI generator](https://openapi-generator.tech/docs/generators/#client-generators) can be added to the generation, provided they make a common enough use case.