Full social API.

This commit is contained in:
Samuel Clay 2012-06-21 00:09:17 -07:00
parent 7e9d2f8055
commit 730c27c5c5
2 changed files with 238 additions and 7 deletions

View file

@ -14,17 +14,22 @@
<div class="NB-module">
<h5 class="NB-module-title">Introduction to the API</h5>
<div class="NB-module-content">
<p><a href="/">NewsBlur</a> is an RSS feed reader with intelligence.</p>
<p><a href="/">NewsBlur</a> is a social news reader with intelligence. A new sound of
an old instrument.</p>
<p>NewsBlur's API allows users to retrieve their feeds, feed counts, feed icons, feed
statistics, and individual feed stories. No API key is required, but you are required
to authenticate before using any of the API endpoints. Please be considerate, and don't
hammer our servers.</p>
<p>It is a very nice thing to note that this entire API is open-source, including
<p>We're quite pleased to point out that this entire API is open-source, including
the implementation of the endpoints. You can find the source of the
<a href="http://github.com/samuelclay/NewsBlur/tree/master/apps/reader/views.py">/reader/ views</a>,
<a href="http://github.com/samuelclay/NewsBlur/tree/master/apps/rss_feeds/views.py">/rss_feeds/ views</a>,
<a href="http://github.com/samuelclay/NewsBlur/tree/master/apps/reader/views.py">/reader/ views source</a>,
<a href="http://github.com/samuelclay/NewsBlur/tree/master/apps/social/views.py">/social/ views source</a>,
<a href="http://github.com/samuelclay/NewsBlur/tree/master/apps/rss_feeds/views.py">/rss_feeds/ views source</a>,
as well as
<a href="http://github.com/samuelclay/NewsBlur/tree/master/templates/static/api.yml">the API definitions in YAML</a>.</p>
<p>We love pull requests. If you want to add an endpoint, modify output, or make
something better, <a href="http://github.com/samuelclay/NewsBlur">NewsBlur's repo
on Github</a> is the place to make that happen.</p>
</div>
</div>

View file

@ -39,7 +39,7 @@
- key: email
desc: "Email address"
optional: true
example: "samuel@ofbrooklyn.com"
example: "samuel@newsblur.com"
- feeds:
- url: /rss_feeds/search_feed
@ -231,7 +231,9 @@
- key: story_id
desc: "List of story ids to mark as read."
required: true
example: "[12, 24, 36]"
example: >
["http://blog.newsblur.com/post/1",
"http://blog.newsblur.com/post/2"]
- key: feed_id
desc: "Feed id that each story is from."
required: true
@ -309,7 +311,231 @@
optional: true
default: "0"
example: "7"
- social:
- url: /social/share_story
method: POST
short_desc: "Share a story with optional comments."
long_desc:
- "Share a story with optional comments. The story is shared on the user's blurblog."
params:
- key: feed_id
desc: "Feed id that the story is from."
required: true
example: "42"
- key: story_id
desc: "Story id to share."
required: true
example: "http://blog.newsblur.com/post/1"
- key: comments
desc: "The meat of the share."
optional: true
example: "42"
- key: source_user_id
desc: >
If the story is being re-shared from another blurblog, note the
user_id of the original sharer.
optional: true
example: "128"
- url: /social/unshare_story
method: POST
short_desc: "Remove a shared story from user's blurblog."
long_desc:
- >
Removes a shared story from a user's blurblog. Unshares the story and
removes the comments. Any replies will also be deleted. This may change.
params:
- key: feed_id
desc: "Feed id that the story is from."
required: true
example: "42"
- key: story_id
desc: "Story id to remove the existing share."
required: true
example: "http://blog.newsblur.com/post/1"
- url: /social/load_user_friends
method: GET
short_desc: "Lists of user profiles: followers, followings, etc."
long_desc:
- This lists the user profiles of followers and followings of a user.
- Also returns information related to which sharing services a user is using.
- url: /social/profile
method: GET
short_desc: "Public profile of a user."
long_desc:
- "Public profile of a user. Includes common followers and common followings."
params:
- key: user_id
desc: "User id of user"
required: true
example: "42"
- url: /social/load_user_profile
method: GET
short_desc: "Private details of the current user's profile and connected services."
long_desc:
- "Private details of the current user's profile and connected services."
- url: /social/save_user_profile
method: POST
short_desc: "Saves a user's profile details."
long_desc:
- "Saves a user's profile details."
params:
- key: location
desc: "Hometown"
optional: true
example: "New York City"
- key: bio
desc: "160 character bio."
optional: true
example: "Developer. API Designer."
- key: website
desc: "Website address"
optional: true
example: "http://www.samuelclay.com"
- key: photo_service
desc: "Which photo service to use: twitter, facebook, gravatar."
optional: true
example: "twitter"
- url: /social/interactions
method: GET
short_desc: "Interactions between a user and other users."
long_desc:
- "Interactions between a user and other users."
- Currently only serves HTML. Email samuel@newsblur.com if you want this data in JSON.
- url: /social/follow
method: POST
short_desc: "Follow a user and subscribe to their blurblog."
long_desc:
- "Follow a user and subscribe to their blurblog."
params:
- key: user_id
desc: "ID of user to follow."
required: true
example: "42"
- url: /social/unfollow
method: POST
short_desc: "Unfollow a user and unsubscribe from their blurblog."
long_desc:
- "Unfollow a user and unsubscribe from their blurblog."
params:
- key: user_id
desc: "ID of user to unfollow."
required: true
example: "42"
- url: /social/feed_trainer
method: GET
short_desc: "Get the intelligence classifiers for a blurblog."
long_desc:
- "Get the intelligence classifiers for a blurblog."
params:
- key: user_id
desc: "ID of blurblog's user."
required: true
example: "42"
- url: /social/comments
method: GET
short_desc: "Get all public comments on a shared story."
long_desc:
- "Get all public comments on a shared story."
params:
- key: story_id
desc: "ID of shared story."
required: true
example: "http://blog.newsblur.com/post/1"
- key: feed_id
desc: "ID of feed for the shared story."
required: true
example: "42"
- url: /social/save_comment_reply
method: POST
short_desc: "Saves a reply to a comment."
long_desc:
- "Saves a reply to a comment."
- "Comments can have a number of replies, but they are all one-level deep."
- >
Replying to a comment sends notifications to both original commenter and to
every other replier to the comment.
params:
- key: story_feed_id
desc: "ID of feed the story belongs to."
required: true
example: "42"
- key: story_id
desc: "ID of story being commented on."
required: true
example: "http://blog.newsblur.com/post/1"
- key: comment_user_id
desc: "ID of user who left the original comment that is now being replied to."
required: true
example: "64"
- key: reply_comments
desc: "The content of the reply."
required: true
example: "Brilliant analysis."
- key: original_message
desc: >
If editing an existing reply, provide the original reply so the correct
reply can be overwritten.
optional: true
example: "Brilliant analysis, bro."
- url: /social/find_friends
method: GET
short_desc: "Search for a user by username, email, or blurblog title."
long_desc:
- "Search for a user by username, email, or blurblog title."
params:
- key: query
desc: "Username, email, or part of a blurblog title."
required: true
example: "samuel"
- url: /social/rss/:user_id/:username
method: GET
short_desc: "RSS feed for a blurblog."
long_desc:
- "RSS feed for a blurblog."
tips:
- >
The <code>username</code> url parameter is optional. It's just recommended
if you have it.
- url: /social/stories/:user_id/:username
method: GET
short_desc: "Shared stories from a user's blurblog."
long_desc:
- "Shared stories from a user's blurblog."
- "Comments, replies, and profiles from followed users are automatically included."
tips:
- >
The <code>username</code> url parameter is optional. It's just recommended
if you have it.
- url: /social/page/:user_id/:username
method: GET
short_desc: "A user's shared stories blurblog in HTML."
long_desc:
- "A user's shared stories blurblog in HTML."
- "This may also live at a custom URL, which is specified in the user's full profile."
tips:
- >
The <code>username</code> url parameter is optional. It's just recommended
if you have it.
- url: /social/settings/:user_id/:username
method: GET
short_desc: "A user's full profile."
long_desc:
- "A user's full profile."
tips:
- >
The <code>username</code> url parameter is optional. It's just recommended
if you have it.
- url: /social/statistics/:user_id/:name
method: GET
short_desc: "Get statistics and history for a blurblog."
long_desc:
- "Get statistics and history for a blurblog."
tips:
- >
The <code>username</code> url parameter is optional. It's just recommended
if you have it.
- "feed management":
- url: /reader/add_url
method: POST