Welcoming Google Feeds API users

Welcoming Google Feeds API users

It finally happened, Google shutdown their feed API after 6 months of deprecation. Many many websites are now broken and yours may be too. Superfeedr is an alternative and we’d love to see you move over.

TL;DR

  • Superfeedr is not exactly like Google. Yet, what you achieved with their API can also be achieved with Superfeedr
  • We charge for our services. There is a free tier but you may go beyond it.
  • Each RSS/Atom feed you’ll be polling from us has to be previously subscribed to (we need to know about the feed)
  • Think about the other way to use Superfeedr: push!

Loading feeds using Javascript and Jquery

This is, by far, the most common request we’re getting, so we’re diving into this as an example and a detailed tutorial.

Open a subscriber account

We provide 3 types of account. For our use case, we need a subscriber account. This should be simple and straight forward.

Subscribers can retrieve content from 3rd party feeds, as well as be notified when these feeds changed. We are also able to convert these feeds to JSON for the subscribers.

Create an authentication token

When interacting with Superfeedr’s API, you should use tokens. Each token has different rights and you can create and delete an unlimited number of tokens.

Here, we want to create a token to retrieve, so we only check that box. We also give a name to the token.

Once the token has been created, click on its name and you should see its value.

Subscribe

It’s now time to tell Superfeedr which feed(s) you want to retrieve from Superfeedr. We call this subscribing. Here, we assume that the list of feeds is already known, so we can do it using the Superfeedr website… but you could also do it programatically by sending API requests to subscribe.

From the Superfeedr dashboard, click on Manage Subscriptions. If you’re just starting, you should see an empty table with the mention There are no matching subscription.. Click on the “New Subscription” button in the bottom right corner. This should open a modal like this one.

  • hub.topic is the url of the feed to which you want to subscribe
  • format : pick json
  • hub.callback: put https://push.superfeedr.com/dev/null. This tells us that you don’t want us to send you notifications.
  • You can leave the last field empty.

Repeat this step for any feed you want to retrieve from us later.

Retrieve the content

Now comes the most important part: the API request. The content is directly accessible from a single URL. The Superfeedr PuSH console can help us build this url which can later integrate in our Javascript application. From the dashboard, click on “Debug PuSH API requests”.

The console lets you build requests and test them.

  • Step 1: in the dropdown, pick the token you created earlier.
  • Step 2: in the dropdown, select the retrieve mode.
  • Step 3: add the right values to each parameter:
    • hub.topic should be the feed URL.
    • count is the number of items you want to retrieve
    • format use json
    • You can leave the other fields empty.

The rightmost column shows you the request being built for the command line tool curl. However, if you click on the Open in new tab button, you can also see the result in your browser directly, and you can of course copy the URL to use it in your application.

For my example, the URL I get is this one.

Implementing in your javascript application

This part is not specific to Superfeedr at all… but it should still be helpful if you’re integrating the RSS feed in your pages. Here’s how to invoke the API from jquery:

var url =
"https://push.superfeedr.com/?hub.mode=retrieve&hub.topic=http%3A%2F%2Ffeeds.gawker.com%2Fgizmodo%2Ffull&count=10&format=json&authorization=ZGVtbzo0ZjdlMThjNDYyYjI0MzU0NmRlODUzMzljOWFhMDcwYQ%3D%3D&"; // See above!

$.ajax({
  url: url,
  dataType: 'json',
  success: function(data) {
    // Data now contains the feed data!
    // Check our schema for details: http://documentation.superfeedr.com/schema.html#json
    console.log(data);
    // This will log the content to your browser's console.
  }
});

Final note

Of course, there are many other things which you can do with Superfeedr like these

Please, get in touch with any question or comment!

Liked this post? Read the archive or

On the same topic, check we love http basic, searching subscriptions and xmpp-ftw xmpp and json for the web.

Previously, on the Superfeedr blog: Converting RSS to JSON.