Subscriptions endpoint draft spec #12
Replies: 4 comments 21 replies
-
|
Just a note: this doesn't include the data flow or database structure for this information. I'll write that up separately. |
Beta Was this translation helpful? Give feedback.
-
|
Some first-read quick feedback on a formal level:
|
Beta Was this translation helpful? Give feedback.
-
|
I think a huge issue we haven't covered yet needs to be solved: The GUID in the RSS-Feed has the highest priority. This means when I create a new subscription using the A possible solution would be to try to fetch the Feed, extract the GUID and everything is fine. Only if this doesn't work in a short amount of time, we generate an GUID. The server may then try to fetch the Feed in the background from time to time in order to update if required. I just checked the proposal again and I think there is no specification for fetching the Feed URL anyways, which probably should be changed. |
Beta Was this translation helpful? Give feedback.
-
|
I'm not sure in which case the edit: the problem that could occur is that the state |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Subscriptions endpoint
The subscriptions endpoint is used to synchronize subscriptions between a server and connected clients. A client can perform the following actions:
The server is treated as the authoritative source for subscription information. Clients can query the endpoint by specifying the datetime from which they want to fetch changes to ensure they only fetch information that is relevant to them since their last sync.
Authentication
All endpoints use Oauth 2 to authenticate. The exact mechanism is still open for discussion. Users create Oauth tokens by authenticating with an account on the server. When they query the endpoints, they are able to interact only with information relating to their account.
GUID authority
GUIDs are a feature of the Podcasting 2.0 specification which uniquely identify the podcast. To handle this and ensure that this API complies with the Podcasting 2.0 spec, all subscription entries must be assigned a GUID.
For the best compatibility, the following sources should be used in order of preference:
guidfield in the source RSS feed. This should not change at any point in the future and should be considered authoritativepodcastGuidfield returned by the Podcast Index's/podcasts/byfeedurlendpoint. This should only be queried if:guidfield, possibly due to being out-of-dateguidthat is generated only if neither of the above sources contain any informationGet all subscriptions
This endpoint enables clients to return all subscription information relating to the authenticated user. It returns the following information:
feed_urlguidis_subscribedsubscription_changedis_subscribedfield was last updated. Presented in ISO 8601 formatguid_changednew_guidParameters
The client can attach an optional
sinceparameter in the path This is a Datetime parameter that specifies the range of data the endpoint will return. The endpoint will only return objects in which either thesubscription_changedorguid_changedfields were updated after the datetime specified in thesinceparameter.Server-side behavior
If the entry contains a
new_guid, the server should return the newestguidassociated with the entry. For example: if a subscription has received 2 newguids, the server should follow these entries and only return the last one it finds. This ensures the client has the most up-to-date entry for the subscription.Example request
Example 200 response
{ "subscriptions": [ { "feed_url": "https://example.com/rss1", "guid": "31740ac6-e39d-49cd-9179-634bcecf4143", "is_subscribed": true, "guid_changed": "2022-09-21T10:25:32.411Z", "new_guid": "8d1f8f09-4f50-4327-9a63-639bfb1cbd98" }, { "feed_url": "https://example.com/rss2", "guid": "968cb508-803c-493c-8ff2-9e397dadb83c", "is_subscribed": false, "subscription_changed": "2022-04-24T17:53:21.573Z" } ] }Get a single subscription
This endpoint returns subscription information relating to a specific subscription for the authenticated user. It returns the following information:
feed_urlguidis_subscribedsubscription_changedis_subscribedfield was last updated. Presented in ISO 8601 formatguid_changednew_guidServer-side behavior
If the entry contains a
new_guid, the server should return the newestguidassociated with the entry. For example: if a subscription has received 2 newguids, the server should follow these entries and only return the last one it finds. This ensures the client has the most up-to-date entry for the subscription.Example request
curl --location '/subscriptions/968cb508-803c-493c-8ff2-9e397dadb83c'Example 200 response
{ "feed_url": "https://example.com/rss2", "guid": "968cb508-803c-493c-8ff2-9e397dadb83c", "is_subscribed": true }Add new subscriptions
This endpoint enables clients to add new subscriptions to the system for the authenticated user. It returns the following information:
feed_urlguidis_subscribedsubscription_changedis_subscribedfield was last updated. Presented in ISO 8601 formatParameters
The client must provide an array of
feed_urlsin the request body to add them to the system.{ "feed_urls": [ "https://example.com/rss1", "https://example.com/rss2", "https://example.com/rss3", "https://example.com/rss4" ] }Server-side behavior
When new feeds are posted to the server, the server must perform the following actions:
guidfield and save this as theguidif it exists/podcasts/byfeedurlendpoint for the feed in question. If there is a response and it contains apodcastGuidfield, save this value as theguidguidis found, generate a new one and assign it to the entry'sguidfield.is_subscribedfield totrueExample request
Example 200 response
{ "subscriptions": [ { "feed_url": "https://example.com/rss1", "guid": "8d1f8f09-4f50-4327-9a63-639bfb1cbd98", "is_subscribed": true, "subscription_changed": "2023-02-23T14:00:00.000Z" }, { "feed_url": "https://example.com/rss2", "guid": "968cb508-803c-493c-8ff2-9e397dadb83c", "is_subscribed": true, "subscription_changed": "2023-02-23T14:00:00.000Z" }, { "feed_url": "https://example.com/rss3", "guid": "e672c1f4-230d-4ab4-99d3-390a9f835ec1", "is_subscribed": true, "subscription_changed": "2023-02-23T14:00:00.000Z" }, { "feed_url": "https://example.com/rss4", "guid": "2d8bb39b-8d34-48d4-b223-a0d01eb27d71", "is_subscribed": true, "subscription_changed": "2023-02-23T14:00:00.000Z" }, ] }Update an existing subscription
This endpoint allows clients to update information about a subscription. It returns the following information:
new_feed_urlfeed_urlfield was updated by the requestis_subscribedis_subscribedfield was updated by the requestsubscription_changedis_subscribedfield was last updated. Presented in ISO 8601 format. Only returned if theis_subscribedfield was updated by the requestguid_changedguidfield was updated by the requestnew_guidguidfield was updated by the requestParameters
The client must provide an the following parameters in the request body:
new_feed_urlnew_guidis_subscribedExample request
Example 200 response
{ "new_feed_url": "https://example.com/rss5", "is_subscribed": false, "subscription_changed": "2023-02-23T14:41:00.000Z", "guid_changed": "2023-02-23T14:41:00.000Z", "new_guid": "965fcecf-ce04-482b-b57c-3119b866cc61" }Delete an existing subscription
This endpoint allows clients to mark a feed as deleted. This prevents the server from updating the feed in the background and prevents the server returning any information such as playback positions relating to the given associated feed. It returns the following information:
feed_urlguidis_deletedServer-side behavior
When a
DELETErequest is received, the server must do the following:is_deletedflag in the subscriptions table totrueis_deletedflag on any previous entries in the subscriptions table relating to the feed totrueExample request
curl --location --request POST '/subscriptions/2d8bb39b-8d34-48d4-b223-a0d01eb27d71'Example 200 response
{ "feed_url": "https://example.com/rss5", "guid": "2d8bb39b-8d34-48d4-b223-a0d01eb27d71", "is_deleted": true }Beta Was this translation helpful? Give feedback.
All reactions