From e81a843b0969907af3db5875f55c083c57cbf35c Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Fri, 22 Apr 2011 10:05:22 -0400 Subject: [PATCH] API continuing to evolve. --- media/css/reader.css | 10 +- media/js/newsblur/assetmodel.js | 8 - templates/static/api.xhtml | 495 +++++++++++++++++--------------- 3 files changed, 276 insertions(+), 237 deletions(-) diff --git a/media/css/reader.css b/media/css/reader.css index 4cde40485..96f5216d6 100644 --- a/media/css/reader.css +++ b/media/css/reader.css @@ -5084,9 +5084,6 @@ background: transparent; margin-top: 36px; font-size: 24px; } -.NB-static h3:first-child { - margin-top: 24px; -} .NB-static h4 { font-size: 16px; margin: 24px 0 12px; @@ -5220,12 +5217,17 @@ background: transparent; .NB-static-api .NB-anchor { position:relative; - top: -60px; + top: -120px; display: block; } .NB-static-api h3 { margin-top: 64px; } +.NB-static-api .NB-api-endpoint { +/* margin-left: 12px;*/ + padding-left: 18px; + border-left: 6px solid #EDCE24; +} .NB-static-api .optional, .NB-static-api .required { padding: 2px 4px; diff --git a/media/js/newsblur/assetmodel.js b/media/js/newsblur/assetmodel.js index 3493c6ed4..9f0df1b17 100644 --- a/media/js/newsblur/assetmodel.js +++ b/media/js/newsblur/assetmodel.js @@ -533,14 +533,6 @@ NEWSBLUR.AssetModel.Reader.prototype = { return null; }, - process_opml_import: function(data, callback) { - if (NEWSBLUR.Globals.is_authenticated) { - this.make_request('/import/process', data, callback); - } else { - if ($.isFunction(callback)) callback(); - } - }, - save_classifier_story: function(story_id, data, callback) { if (NEWSBLUR.Globals.is_authenticated) { this.make_request('/classifier/save/story/', data, callback); diff --git a/templates/static/api.xhtml b/templates/static/api.xhtml index dffec008f..e33a78f32 100644 --- a/templates/static/api.xhtml +++ b/templates/static/api.xhtml @@ -16,38 +16,55 @@
API Table of Contents
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Feeds
/reader/feedsUser's feeds, with unread counts, meta data, and optional favicons.
/reader/faviconsFavicons for each of a user's feeds.
/reader/page/:idOriginal page from a single feed.
Stories
/reader/feed/:idStories from a single feed.
/reader/starred_storiesUser's starred stories.
/reader/river_storiesStories from multiple feeds (River of News).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Feeds
/reader/feedsUser's feeds, with unread counts, meta data, and optional favicons.
/reader/faviconsFavicons for each of a user's feeds.
/reader/page/:idOriginal page from a single feed.
/reader/refresh_feedsGet latest unread counts for active feeds.
Stories
/reader/feed/:idStories from a single feed.
/reader/starred_storiesUser's starred stories.
/reader/river_storiesStories from multiple feeds (River of News).
Import/Export
/import/opml_uploadUpload OPML file.
/import/opml_exportDownload backup of feeds as an OPML file.
+
@@ -55,121 +72,144 @@
Feeds
- -

GET /reader/feeds

- +
+

GET /reader/feeds

+ -
    -
  • Retrieve a user's list of feeds. Includes the 3 unread counts (positive, neutral, - negative), as well as optional favicons.
  • -
+
    +
  • Retrieve a user's list of feeds. Includes the 3 unread counts (positive, neutral, + negative), as well as optional favicons.
  • +
- - - - - - - - - - - - - - - - - - - -
ParameterDescriptionDefaultExample
include_faviconsOptional Include - favicons inline. Since they can be time consuming to download, you can optionally - turn them off. Use /api/v1/feeds/favicons/ to retrieve the favicons in a - separate request.truetrue/false
flatOptional Returns a flat folder structure instead of nested folders. Useful when displaying all folders in a single depth without recursive descent.falsetrue/false
+ + + + + + + + + + + + + + + + + + + +
ParameterDescriptionDefaultExample
include_faviconsOptional Include + favicons inline. Since they can be time consuming to download, you can optionally + turn them off. Use /api/v1/feeds/favicons/ to retrieve the favicons in a + separate request.truetrue/false
flatOptional Returns a flat folder structure instead of nested folders. Useful when displaying all folders in a single depth without recursive descent.falsetrue/false
-

Example Response

+

Example Response

-

+        

+  {
+    'feeds': []
+  }
+        
+ +

Tips

+ +
    +
  • Use /reader/refresh_feeds to get updated unread counts.
  • +
  • Turn off include_favicons if you can either cache favicons or can + wait to fetch them.
  • +
+
+ + +
+

GET /reader/favicons

+ + +
    +
  • Retrieve a list of favicons for a list of feeds. Used when combined with + /reader/feeds and include_favicons=false, so the + feeds request contains far less data. Useful for mobile devices, but requires a + second request.
  • +
+ + + + + + + + + + + + + + +
ParameterDescriptionDefaultExample
feedsOPTIONAL Array of feed ids. Leave empty to retrieve all active (enabled) feeds.[1, 2, 3]
+ +

Example Response

+ +

+  {
+    'feeds': []
+  }
+        
+ +

Tips

+ +
    +
  • To use inline data images, you can use this syntax: +
    
    +  <img src="data:image/png;base64,[IMAGE_DATA_STRING]" />
    +            
    +
  • +
+
+ + +
+

GET /reader/page/:id

+ + +
    +
  • Retrieve the original page from a single feed.
  • +
+ +

Example Response

+ +

+  {#  #}
+  {#  #}
+  {#    #}
+  {#   Proxied Page #}
+  {#  #}
+  {#  #}
+  {#   

This is a proxied page. This is straight HTML.

#} + {# #} + {# #} +
+
+ + +
+

GET /reader/refresh_feeds

+ + +
    +
  • Up-to-the-second unread counts for each active feed.
  • +
  • Poll for these counts no more than once a minute.
  • +
+ +

Example Response

+ +

 {
   'feeds': []
 }
-      
- -

Tips

- -
    -
  • Use /reader/refresh_feeds to get updated unread counts.
  • -
  • Turn off include_favicons if you can either cache favicons or can - wait to fetch them.
  • -
- - - -

GET /reader/favicons

- - -
    -
  • Retrieve a list of favicons for a list of feeds. Used when combined with - /reader/feeds and include_favicons=false, so the - feeds request contains far less data. Useful for mobile devices, but requires a - second request.
  • -
- - - - - - - - - - - - - - -
ParameterDescriptionDefaultExample
feedsOPTIONAL Array of feed ids. Leave empty to retrieve all active (enabled) feeds.[1, 2, 3]
- -

Example Response

- -

-{
-  'feeds': []
-}
-      
- -

Tips

- -
    -
  • To use inline data images, you can use this syntax: -
    
    -<img src="data:image/png;base64,[IMAGE_DATA_STRING]" />
    -          
    -
  • -
- - -

GET /reader/page/:id

- - -
    -
  • Retrieve the original page from a single feed.
  • -
- -

Example Response

- -

-{#  #}
-{#  #}
-{#    #}
-{#   Proxied Page #}
-{#  #}
-{#  #}
-{#   

This is a proxied page. This is straight HTML.

#} -{# #} -{# #} -
+
+
@@ -185,106 +225,110 @@
-

GET /reader/feed/:id

- +
+

GET /reader/feed/:id

+ -
    -
  • Retrieve stories from a single feed.
  • -
+
    +
  • Retrieve stories from a single feed.
  • +
- - - - - - - - - - - - - -
ParameterDescriptionDefaultExample
pageoptional Page of stories, starting from 1.12
+ + + + + + + + + + + + + +
ParameterDescriptionDefaultExample
pageoptional Page of stories, starting from 1.12
-

Example Response

+

Example Response

-

-{
-  'feeds': []
-}
-      
+

+  {
+    'feeds': []
+  }
+        
+
+
+

GET /reader/starred_stories

+ -

GET /reader/starred_stories

- +
    +
  • Retrieve a user's starred stories.
  • +
-
    -
  • Retrieve a user's starred stories.
  • -
- - - - - - - - - - - - - - -
ParameterDescriptionDefaultExample
pageoptional Page of starred stories, starting from 1.12
+ + + + + + + + + + + + + +
ParameterDescriptionDefaultExample
pageoptional Page of starred stories, starting from 1.12
-

Example Response

+

Example Response

-

-{
-  'feeds': []
-}
-      
+

+  {
+    'feeds': []
+  }
+        
+
-

GET /reader/river_stories

- +
+

GET /reader/river_stories

+ -
    -
  • Retrieve stories from a collection of feeds. This is known as the River of News.
  • -
  • Stories are ordered in reverse chronological order.
  • -
+
    +
  • Retrieve stories from a collection of feeds. This is known as the River of News.
  • +
  • Stories are ordered in reverse chronological order.
  • +
- - - - - - - - - - - - - - - - - - - -
ParameterDescriptionDefaultExample
feedsrequired List of feed ids.[12, 24, 36]
pageoptional Page of stories, starting from 1.12
+ + + + + + + + + + + + + + + + + + + +
ParameterDescriptionDefaultExample
feedsrequired List of feed ids.[12, 24, 36]
pageoptional Page of stories, starting from 1.12
-

Example Response

- -

-{
-  'feeds': []
-}
-      
+

Example Response

+

+  {
+    'feeds': []
+  }
+        
+
@@ -298,7 +342,8 @@
Intelligence
- +
+