From b28773b3a0a368a96715d8fbc0da33de72adccef Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 11 Jan 2022 16:53:58 +0700 Subject: [PATCH] add exmples, auth docs, and list endpoints --- tubearchivist/api/README.md | 54 ++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/tubearchivist/api/README.md b/tubearchivist/api/README.md index 16092fd..e838002 100644 --- a/tubearchivist/api/README.md +++ b/tubearchivist/api/README.md @@ -1,14 +1,60 @@ -# TubeArchivist API endpoints -Documentation of available API endpoints +# TubeArchivist API +Documentation of available API endpoints. +**Note: This will change!** + +## Authentication +API token will get automatically created, accessible on the settings page. Token needs to be passed as an authorization header with every request. Additionally session based authentication is enabled too: When you are logged in to your TubeArchivist instance, you'll have access to the api in the browser for testing. + +Curl example: +```shell +curl -v /api/video// \ + -H "Authorization: Token xxxxxxxxxx" +``` + +Python requests example: +```python +import requests + +url = "/api/video//" +headers = {"Authorization": "Token xxxxxxxxxx"} +response = requests.get(url, headers=headers) +``` ## Videos /api/video/\/ -## Channels +## Channel List View +/api/channel/ + +### Subscribe to a list of channels +POST /api/channel +```json +{ + "data": [ + {"channel_id": "UC9-y-6csu5WGm29I7JiwpnA", "channel_subscribed": true} + ] +} +``` + +## Channel Item View /api/channel/\/ ## Playlists /api/playlist/\/ -## Download Queue +## Download Queue List View +/api/download/ + +### Add list of videos to download queue + +POST /api/download/ +```json +{ + "data": [ + {"youtube_id": "NYj3DnI81AQ", "status": "pending"} + ] +} +``` + +## Download Queue Item View /api/download/\/