update settings API
[mygpo.git] / doc / api / reference / settings.rst
blob86e95aa44cbeb04315d076e8abc58ca696271fb0
1 Settings API
2 ============
4 Clients can use the gpodder.net API to store and exchange settings. Clients can
5 chose to simply store their settings on gpodder.net for online backup, or
6 exchange settings with other clients. Some settings also trigger behaviour on
7 the gpodder.net website.
9 Settings can be stored in several scopes. Each user has one *account* scope,
10 and one *device* scope per device. Additionally settings can be stored
11 per *podcast* and *episode*.
14 Resources
15 ---------
17 The Settings API defines the following resources ::
19     /user/<username>/settings/account
20     /user/<username>/settings/device
21     /user/<username>/settings/podcast
22     /user/<username>/settings/episode
25 Well-Known Settings
26 -------------------
28 Although settings are primarily used to exchange settings between clients, some
29 of them also trigger some behavior on the website.
32 Account scope
33 ^^^^^^^^^^^^^
35 The following settings are well-known in the account scope.
37 **public_profile**
38     when set to False, sets all podcasts to private (as on
39     http://gpodder.net/account/privacy, currently deactivated via API)
41 **store_user_agent**
42     allow gpodder.net to store the User-Agent for each
43     device (default: true)
45 **public_subscriptions**
46     default "public" value for subscriptions (default: true)
48 **flattr_token**
49     auth-token for a Flattr login; empty when not logged in (default: empty)
51 **auto_flattr**
52     auto-flattr episodes, only relevant when logged into Flattr account
53     (default: false)
55 **flattr_mygpo**
56     automatically flattr gpodder.net, only relevant when logged into Flattr
57     account (default: false)
59 **flattr_username**
60     username under which own items (eg podcast lists) are published
61     (default: empty)
64 Episode scope
65 ^^^^^^^^^^^^^
67 The following settings are well-known in the episode scope.
69 **is_favorite**
70     flags the episode as favorite (can be done on any episode-page)
73 Podcast scope
74 ^^^^^^^^^^^^^
76 The following settings are well-known in the podcast scope.
78 **public_subscription**
79     when set to False, sets the subscription to this podcast to private
80     (as on http://gpodder.net/account/privacy or any podcast-page, currently
81     deactivated via API)
84 Saving Settings
85 ---------------
87 Save Settings ::
89     POST /user/<username>/settings/<scope>?<scope-specification>
92 * Requires authentication
95 Parameters
96 ^^^^^^^^^^
98 **scope**
99   can be either ``account``, ``device``, ``podcast`` or ``episode``
101 **podcast**
102   should contain the URL-encoded feed URL when ``scope`` is ``podcast`` or ``episode``
104 **episode**
105   should contain the URL-encoded media URL when ``scope`` is ``episode``
107 **device**
108   should contain the device Id when ``scope`` is ``device``
111 Request Body
112 ^^^^^^^^^^^^
114 TODO: JSON-Patch ?
116 Post-Data ::
118     {
119      "set": {"setting1": "value1", "setting2": "value2"},
120      "remove": ["setting3", "setting4"]
121     }
123 set is a dictionary of settings to add or update; remove is a list of keys that
124 shall be removed from the scope.
126 Response
127 ^^^^^^^^
129 The response contains all settings that the scope has after the update has been
130 carried out. ::
132     {
133      "setting1": "value1",
134      "setting2": "value"
135     }
139 Get Settings
140 ------------
142 Get Settings ::
144     GET /user/<username>/settings/<scope>?<scope-specification>
146 Scope and specification as above.
147 Requires Authentication
150 Response
151 ^^^^^^^^
153 The response contains all settings that the scope currently has ::
155     {"setting1": "value1", "setting2": "value2"}