{ "url": "<feedURL>" }
Description: Creates a feed from <feedUrl>
by making a HTTP request to the feed URL and saving it to the database.
This operation will fail if (in order):
- Feed URL is an invalid URI (validation error)
- A feed already exists with the requested feed URL (must be unique: validation error)
- Feed URL does not resolve to a host
- The request to the feed URL returns a bad status code (e.g. 404)
- The response is not a feed, but something else (e.g. a HTML page)
- The response is a feed, but is missing a title (invalid feed: validation error(?))
For each of these potential failure areas, how should the API respond?
- Obivously a client error and should return a 400
- Obivously a client error and should return a 400
- The client input was valid, so what status code should this return?
- The client input was valid, so what status code should this return?
- The client input was valid, so what status code should this return?
- The client input was valid, so what status code should this return? Technically this is an error when validating the feed (the title is required).
Sometimes it is also useful for the server to ignore duplicate requests. If you're just storing the POSTed feed you could just return the created resource instead of failing. It makes it easier on the client as they can just retry their POST requests if they had any kind of error.
Another alternative is to let the client post to /feeds/{uuid} and store the UUID with the feed on the server.