Feedbin API V2 Documentation

repository·master·Indexed 19 days ago

https://github.com/feedbin/feedbin-api

REST-style API for interacting with Feedbin services. Features include managing feeds, entries, and saved searches, importing OPML files, and saving webpages for later reading. Includes a full content extraction service powered by the Mercury Parser, support for HTTP Basic authentication, ISO 8601 date formatting, and HTTP caching for performance.

Tokens
10.6K
Snippets
53
Records
60
Agent score
65%

What's inside Feedbin API

  1. Use `extracted_content_url` for full content extraction

    master

    The extracted_content_url provides a link to a Feedbin service powered by Mercury Parser. This service attempts to extract the full content of the entry's original url and returns a JSON object compatible with Mercury Parser.

    Example Response Format from the extraction service:

    {
      "title": "Thunder (mascot)",
      "content": "... <p><b idea="Thunder</b> is the <a href="https://en.wikipedia.org/wiki/Stage_name">stage name</a> for the...",
      "author": "Wikipedia Contributors",
      "date_published": "2016-09-16T20:56:00.000Z",
      "lead_image_url": null,
      "dek": null,
      "next_page_url": null,
      "url": "https://en.wikipedia.org/wiki/Thunder_(mascot)",
      "domain": "en.wikipedia.org",
      "excerpt": "Thunder Thunder is the stage name for the horse who is the official live animal mascot for the Denver Broncos",
      "word_count": 4677,
      "direction": "ltr",
      "total_pages": 1,
      "rendered_pages": 1
    }
  2. Handle pagination for Entries

    master

    Entries are paginated with a limit of 100 items per page.

    Paginated responses include a Links header containing URLs for navigating the result set. The supported rel values are:

    • first: The URL of the first page.
    • prev: The URL of the previous page.
    • next: The URL of the next page.
    • last: The URL of the last page.

    Total Record Count

    The response header X-Feedbin-Record-Count provides the total number of records available for that resource.

    Links: <https://api.feedbin.com/v2/feeds/1/entries.json?page=2>; rel="next", <https://api.feedbin.com/v2/feeds/1/entries.json?page=5>; rel="last"
    X-Feedbin-Record-Count: 500
  3. Understand `extended` mode metadata

    master

    When using mode=extended, the API returns additional metadata fields. This mode is designed to be additive; new keys may be added in the future, so your JSON parser should be flexible.

    Additional fields in extended mode include:

    • original: The JSON for the full original entry (if updated).
    • images: Extracted image associated with the entry.
    • enclosure: Podcast-related metadata.
    • twitter_id: The ID of the tweet (if the entry is a tweet).
    • twitter_thread_ids: Array of related tweet IDs for loading threads via the Twitter API.
    • extracted_articles: Extracted article content if the entry is a tweet linking to articles.
    • json_feed: Metadata if the entry is from a JSON Feed.
    {
        "id": 1682191545,
        "feed_id": 1379740,
        "title": "Peter Kafka @pkafka",
        "twitter_id": 973315765393920000,
        "twitter_thread_ids": [973315765393920000, 973315765393920001],
        "images": {
            "original_url": "http://www.macdrifter.com/uploads/2018/03/ScreenShot20180312_044129.jpg"
        }
    }
  4. Format dates using ISO 8601

    master

    The Feedbin API uses the ISO 8601 date format. All requests and responses must adhere to this specification.

    Precision and the since parameter

    Dates are high-resolution. When using the since parameter to fetch updates, use the exact date string returned by the server from your previous request. Do not round down to the nearest second, as this will likely cause duplicate entries in your results.

    Format Example

    YYYY-MM-DDThh:mm:ss.ssssssTZD

    • UTC: 2013-02-19T15:33:38.449047Z
    • With Timezone: 2013-02-19T07:33:38.449047-08:00
  5. How the `extended` mode works

    master

    When using the mode=extended parameter on subscription endpoints, the API includes a json_feed key in the response. This key contains additional metadata following the JSON Feed specification, such as favicon, icon, and home_page_url.

    {
      "id" : 1,
      "feed_id" : 1,
      "site_url" : "https://micro.blog/",
      "title" : "Micro.blog - manton timeline",
      "feed_url" : "https://micro.blog/feeds/manton.json",
      "created_at" : "2019-05-23T23:49:14.487938Z",
      "json_feed" : {
        "favicon" : "https://micro.blog/images/icons/favicon_32.png",
        "feed_url" : "https://micro.blog/feeds/manton.json",
        "icon" : "https://micro.blog/images/icons/favicon_256.png",
        "version" : "https://jsonfeed.org/version/1",
        "home_page_url" : "https://micro.blog/",
        "title" : "Micro.blog - manton timeline"
      }
    }
  6. How to provide a tailored Twitter experience using Feedbin

    master

    While Feedbin supports Twitter subscriptions automatically, you can build a custom Twitter experience by combining Feedbin data with the Twitter API. Because Twitter's terms of service prohibit redistributing their API data, you should use Feedbin to discover tweet IDs and then use your own Twitter developer credentials to fetch the full tweet content.

    To implement this flow:

    1. Register an application on the Twitter developer site.
    2. Implement a Twitter authentication flow in your application to fetch data on behalf of your users.
    3. Fetch entries from Feedbin using mode=extended to retrieve the necessary Twitter identifiers.
    4. Use Twitter's statuses/lookup API to bulk load the actual tweet content using the IDs provided by Feedbin.
  7. Use HTTP Caching for better performance

    master

    To improve speed and reduce load, use HTTP caching. GET requests return ETag and Last-Modified headers.

    In subsequent requests, include these values in the If-None-Match and If-Modified-Since headers respectively. If the resource has not changed, the server will return a 304 Not Modified response.

    # 1. Initial request to get headers
    curl -v -u 'example@example.com:password' https://api.feedbin.com/v2/subscriptions/3.json
    # Look for ETag and Last-Modified in response
    
    # 2. Subsequent request using those headers
    curl -v -u 'example@example.com:password' \
    --header 'If-Modified-Since:Sat, 02 Feb 2013 15:20:46 GMT' \
    --header 'If-None-Match:"c7d001e87bda1f0d3745b6bd2811b055"' \
    https://api.feedbin.com/v2/subscriptions/3.json
  8. Use the Full Content Extraction Service

    master

    Feedbin provides a full content extraction service for native apps, powered by the Mercury Parser. This service attempts to extract the complete content of a webpage from a given URL.

    Authentication

    To use this service, you must provide:

    1. Your username.
    2. A signature: An HMAC-SHA1 signature of the target URL, generated using your secret signing key.

    Request Format

    The service is accessed via a GET request to the following URL pattern: https://extract.feedbin.com/parser/:username/:signature?base64_url=:base64_url

    Parameters

    • username: Your Feedbin username.
    • signature: The HMAC-SHA1 signature of the URL you want to parse.
    • base64_url: The base64 encoded version of the URL you want to parse. This must use the RFC 4648 url-safe variant with no newlines.

    If your environment does not support URL-safe base64, you can manually convert a standard base64 string by performing these replacements:

    • Replace + with -
    • Replace / with _
    • Remove all newlines (\n)
    https://extract.feedbin.com/parser/:username/:signature?base64_url=:base64_url
  9. Authenticate with the Feedbin API using HTTP Basic Auth

    master

    To authenticate requests to the Feedbin API, you must use HTTP Basic Authentication. You can provide your credentials (email and password) via the Authorization header or by using the built-in support in your HTTP library.

    A common way to verify if a user's credentials are valid is to call the GET /v2/authentication.json endpoint.

    curl --request GET --user "example@example.com:password" https://api.feedbin.com/v2/authentication.json
  10. How to retrieve and view updated entries

    master

    Updated entries are entries that have been modified after their original publication. To handle updates, follow this two-step workflow:

    1. Get the IDs: Call GET /v2/updated_entries.json to receive an array of entry_ids that have been modified.
    2. Get the details: Use the retrieved IDs to call the entries API with specific query parameters to see the changes.

    To see the differences between the original and the latest version, use the following parameters in your entries request:

    • include_original=true: Returns the original version of the entry in an original object.
    • include_content_diff=true: Returns an HTML diff of the original and latest version in the content_diff field.

    The content_diff field contains HTML with specific classes (like .diff-ins) that you can style with CSS to match Feedbin's UI.

    `GET /v2/entries.json?include_original=true&include_content_diff=true&ids=703369824`
  11. Make requests to the Feedbin API

    master

    The Feedbin API is a REST-style API. All requests must use https. The base URL is https://api.feedbin.com/v2/.

    Authentication

    The API uses HTTP Basic authentication. You can authenticate using your email and password.

    Content-Type Header

    When creating or updating a record (e.g., using POST or PATCH), you must set the Content-Type header to application/json; charset=utf-8. Failure to include this header will result in a 415 Unsupported Media Type error.

    # Basic GET request
    curl -u 'example@example.com:password' https://api.feedbin.com/v2/subscriptions.json
    
    # POST request with required Content-Type header
    curl -u 'example@example.com:password' \
    -H "Content-Type: application/json; charset=utf-8" \
    -X POST -d '{"feed_url":"http://daringfireball.net"}' \
    https://api.feedbin.com/v2/subscriptions.json
  12. Format dates in Objective-C

    master

    When working in Objective-C, ensure you force a specific locale (e.g., en_US) and timezone to prevent unexpected formatting based on the user's region.

    ```objectivec
    NSDateFormatter *feedbinDateFormatter = [[NSDateFormatter alloc] init];
    feedbinDateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@