When working with the SuperFeedr REST API it is important to understand the notifications that SuperFeedr will send to your server.
I am using th JSON response here, as the format is familiar and easy to parse using the Ruby API.
After successfully subscribing to a feed, SuperFeedr will send notifications to the callback URI specified during the subscription process.
The notification will be in the form of a POST request to your server. The response body will contain the data. In this case, I specified JSON during the subscription process, therefore, I receive my notifications as JSON.
The JSON response body is accessible via the params
environment variable, when working within the Rails environment.
params["items"] #=> returns array of "items" hashes
Keys:
["id",
"published",
"updated",
"title",
"summary",
"permalinkUrl",
"standardLinks"]
Contains a unique description of the item
=> "gellies-bicycle-handlebar-grips-blue-or-purple-1-free-shipping-2012-11-25t03-09-32z"
Date-time of published date
1353812972
*Not sure about this format
Item title
Gellies Bicycle Handlebar Grips (Blue or Purple) $1 + Free Shipping
Not clear what this is for
<img src=\"http://feeds.feedburner.com/~r/SlickdealsnetFP/~4/WvH9t0qK684\" height=\"1\" width=\"1\"/>"
Might be feed-specific
Contains a permalinkURL if one exists
http://feedproxy.google.com/~r/SlickdealsnetFP/~3/WvH9t0qK684/84194
Contains a hash of additional links, including the originals.
{"alternate"=>
[{"title"=>
"Gellies Bicycle Handlebar Grips (Blue or Purple) $1 + Free Shipping",
"rel"=>"alternate",
"href"=>
"http://feedproxy.google.com/~r/SlickdealsnetFP/~3/WvH9t0qK684/84194",
"type"=>"text/html"}],
"replies"=>
[{"title"=>
"Gellies Bicycle Handlebar Grips (Blue or Purple) $1 + Free Shipping",
"rel"=>"replies",
"href"=>"http://forums.slickdeals.net/showthread.php?threadid=5574034",
"type"=>"text/html"}],
"canonical"=>
[{"title"=>
"Gellies Bicycle Handlebar Grips (Blue or Purple) $1 + Free Shipping",
"rel"=>"canonical",
"href"=>"http://slickdeals.net/permadeal/84194",
"type"=>"text/html"}]}
The request from SuperFeedr also includes information about the feed.
params["status"]
=> {"code"=>200,
"http"=>"Fetched (ring) 200 and parsed 7/8 entries",
"nextFetch"=>1353816615,
"entriesCountSinceLastMaintenance"=>318,
"period"=>900,
"lastFetch"=>1353815715,
"lastParse"=>1353815715,
"lastMaintenanceAt"=>1353769339,
"feed"=>"http://feeds.feedburner.com/SlickdealsnetHT"}
params["items"].first #=>
{"id"=>
"canon-pixma-mx892-all-in-one-office-inkjet-printer-69-free-shipping-no-tax-in-ca-just-ny-pays-tax-5-replies--2012-11-24t22-55-32z",
"published"=>1353797732,
"updated"=>1353797732,
"title"=>
"Canon PIXMA MX892 All-In-One Office Inkjet Printer $69 + Free Shipping (No Tax in CA just NY pays tax) (5 replies)",
"summary"=>
"<img src=\"http://feeds.feedburner.com/~r/SlickdealsnetHT/~4/Z17IMn-N7Mo\" height=\"1\" width=\"1\"/>",
"permalinkUrl"=>
"http://feedproxy.google.com/~r/SlickdealsnetHT/~3/Z17IMn-N7Mo/showthread.php",
"standardLinks"=>
{"alternate"=>
[{"title"=>
"Canon PIXMA MX892 All-In-One Office Inkjet Printer $69 + Free Shipping (No Tax in CA just NY pays tax) (5 replies)",
"rel"=>"alternate",
"href"=>
"http://feedproxy.google.com/~r/SlickdealsnetHT/~3/Z17IMn-N7Mo/showthread.php",
"type"=>"text/html"}],
"canonical"=>
[{"title"=>
"Canon PIXMA MX892 All-In-One Office Inkjet Printer $69 + Free Shipping (No Tax in CA just NY pays tax) (5 replies)",
"rel"=>"canonical",
"href"=>"http://forums.slickdeals.net/showthread.php?t=5573588",
"type"=>"text/html"}]}}