Add a new subscription
This endpoint enables clients to add new subscriptions to the system for the authenticated user. It returns an array of success
responses for newly added subscriptions, and an array of failure
responses for subscriptions that couldn’t be added.
Field | Type | Required? | Description |
---|---|---|---|
feed_url | String | Yes | The URL of the podcast RSS feed |
guid | String | Yes | The globally unique ID of the podcast |
is_subscribed | Boolean | Yes | Whether the user is subscribed to the podcast |
subscription_changed | Datetime | Yes | The date on which the is_subscribed field was last updated. Presented in ISO 8601 format |
Request parameters
The client MUST provide a list of objects containing the following parameters:
Field | Type | Required? | Description |
---|---|---|---|
feed_url | String | Yes | The URL of the podcast RSS feed. The client must provide a protocol (for example: http or https ) and preserve any parameters |
guid | String | No | The GUID found in the podcast RSS feed |
Server-side behavior
When new feeds are posted to the server, the server MUST return a success response to the client immediately to acknowledge the request. To ensure that data can be returned immediately, the following flow MUST be followed:
- The client sends a payload to the server
- For each object in the payload, the server does the following:
- Checks if there’s a
guid
entry in the payload- If a
guid
is present, the server stores theguid
for later use - If no
guid
is present, the server generates aguid
for later use
- If a
- Checks to see if there is an existing entry with the same
guid
orfeed_url
- If an existing entry is found, the server sets the
is_subscribed
field totrue
and updates thesubscription_changed
date to the current date. If thedeleted
field is populated, the field is set toNULL
to show that the subscription is active - If no existing entry is found, the server creates a new subscription entry
- If an existing entry is found, the server sets the
- Checks if there’s a
- The server returns a success payload containing the subscription information for each object in the request payload.
Subscription GUID update
If the client doesn’t send a guid
in the subscription payload, the server MUST create one immediately to ensure the following:
- Each entry has an associated
guid
- The client receives a success response as quickly as possible
Once this is done, the server SHOULD asynchronously verify that there isn’t a more authoritative GUID available. The following flow should be used:
- The server fetches and parses the RSS feed to search for a
guid
field in thepodcast
namespace. - If a more authoritative
guid
is found, the server must update the subscription entry as follows:- Create a new subscription entry with the new
guid
- Update the
new_guid
field in the existing entry to point to the newguid
- Update the
guid_changed
field in the existing entry to the current date
- Create a new subscription entry with the new