update podcast list API draft
[mygpo.git] / doc / api / reference / podcastlists.rst
blobc4f18051bb63a9f464163958d78e4576f27be7fa
1 Podcast Lists API
2 =================
4 **TODO: this has just been copied from API 2 -- this needs review**
6 **Podcast Lists** are used to collect podcasts about some topics. On the
7 website, podcast lists are available at https://gpodder.net/lists/
9 Resources
10 ---------
12 The Podcast Lists API defines the following resources ::
14     /user/{username}/lists/create
15     /user/{username}/lists
16     /user/{username}/list/{listname}
19 Creating a Podcast List
20 -----------------------
22 A podcast list can be created by submitting a list of podcasts to the API.
24 Requires authentication.
26 Parameters
27 ^^^^^^^^^^
29 * **title**: The title of the list (mandatory)
32 Request
33 ^^^^^^^
35 Create a Podcast List ::
37     POST /user/{username}/lists/create
38     Content-Tpe: application/json
40     {
41         "title": "My Tech News",
42         "podcasts": [
43             { "url": "http://example.com/feed.xml" },
44             ...
45         ]
46     }
48 The server then generates a short name for the list from the title given in the
49 request. For example, from the title "My Python Podcasts" the name
50 "my-python-podcasts" would be generated.
52 Responses
53 ^^^^^^^^^
55 If the podcast list has been created successfully, ``303 See Other`` is
56 returned. ::
58     303 See Other
59     Location: /3/user/yourusername/list/yourlistname
61 The list can then be retrieved using a ``GET`` request.
63 If the list could not be created, an error code is returned. If another list
64 with the same (generated) name exists, ``409 Conflict`` is returned. ::
66     {
67         "message": "list already exists",
68         "errors": [
69             {
70                 field: "/title",
71                 code: "duplicate_list_name"
72             }
73         ]
74     }
77 List the Podcast Lists of a User
78 --------------------------------
81 Request
82 ^^^^^^^
84 List User's Lists ::
86     GET /user/{username}/lists
87     Content-Tpe: application/json
90 Response
91 ^^^^^^^^
93 If the user exists, his/her podcast lists are returned. ::
95     200 OK
96     Content-Tpe: application/json
98     {
99         "podcastlists": [
100             {
101                 "title": "My Python Podcasts",
102                 "name": "my-python-podcasts",
103                 "web": "http://gpodder.net/user/username/lists/my-python-podcasts"
104             }
105         ],
106         "username": "username"
107     }
109 If the user does not exist, ``404 Not Found`` is returned. ::
111     404 Not Found
112     Content-Tpe: application/json
114     {
115         "message": "user does not exist",
116         "errors": [
117             {
118                 field: "?username",
119                 code: "user_does_not_exist"
120             }
121         ]
122     }
125 Retrieve Podcast List
126 ---------------------
128 Request
129 ^^^^^^^
131 Retrieve a Podcast List ::
133     GET /user/{username}/list/{listname}
134     Content-Tpe: application/json
137 Response
138 ^^^^^^^^
140 The podcast list is returned. ::
142     200 OK
143     Content-Tpe: application/json
145     {
146         "title": "My Tech News",
147         "name": "my-tech-news",
148         "podcasts": [
149             { "url": "http://example.com/feed.xml" },
150             ...
151         ],
152         "username": "username",
153     }
156 If either the user or the podcast list could not be found ``404 Not Found`` is
157 returned. ::
159     404 Not Found
160     Content-Tpe: application/json
162     {
163         "message": "podcast list does not exist",
164         "errors": [
165             {
166                 field: "?listname",
167                 code: "podcastlist_does_not_exist"
168             }
169         ]
170     }
173 Update
174 ------
176 Request
177 ^^^^^^^
179 Update a Podcast List::
181     PUT /user/{username}/list/{listname}
182     Content-Tpe: application/json
184     {
185         "title": "My Tech News",
186         "name": "my-tech-news2",
187         "podcasts": [
188             { "url": "http://example.org/feed-mp3.xml" },
189             ...
190         ]
191     }
193 requires authentication
196 Response
197 ^^^^^^^^
199 Possible Responses
201 * 404 Not Found if there is no list with the given name
202 * 204 No Content If the podcast list has been created / updated
205 Delete a Podcast List
206 ---------------------
208 Request
209 ^^^^^^^
211 Delete a Podcast List ::
213     DELETE /user/{username}/list/{listname}
215 requires authentication
218 Response
219 ^^^^^^^^
221 If the update was successful, ``204 No Content`` is returned. ::
223     204 No Content
225 * 404 Not Found if there is no podcast list with the given name