Skip to content

Instantly share code, notes, and snippets.

@subosito
Last active December 24, 2015 01:49
Show Gist options
  • Save subosito/6725894 to your computer and use it in GitHub Desktop.
Save subosito/6725894 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Real World API</title>
<meta name="description" content="This API Blueprint demonstrates a real world example documenting a portion of [App.net API](http://developers.app.net).
">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
tt, pre, code {
font-family: Consolas, "Liberation Mono", Courier, monospace;
background-color: transparent !important;
}
pre.prettyprint {
border: 0px !important;
background-color: #fff;
}
.bg-default {
background-color: #F8F8F8;
}
.response-snippet {
display: none;
}
.nav-rg {
width: 262.5px;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="page-header">
<h1>Real World API</h1>
<h2 class="lead"><small><p>This API Blueprint demonstrates a real world example documenting a portion of <a href="http://developers.app.net">App.net API</a>.</p>
</small></h2>
</div>
</div>
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked nav-rg affix" id="group-tab">
<li><a href="#posts" data-toggle="tab"><strong>Posts</strong></a></li>
</ul>
</div>
<div class="col-md-9">
<div class="tab-content">
<div class="tab-pane" id="posts">
<div class="panel panel-default">
<div class="panel-heading">
<h2 id="posts">Posts</h2>
</div>
<div class="panel-body">
<p class="lead"><small>This section groups App.net post resources.
</small></p>
<div class="panel panel-info">
<div class="panel-heading">
<span class="btn btn-primary">GET</span>
<code>/stream/0/posts/{post_id}</code>
</div>
<div class="panel-body">
<p>Returns a specific Post.</p>
</div>
<ul class="list-group">
<li class="list-group-item bg-default"><strong>Parameters</strong></li>
<li class="list-group-item">
<dl class="dl-horizontal">
<dt>post_id</dt>
<dd>
<strong>(required)</strong>
<code>string</code> The id of the Post.
</dd>
</dl>
</li>
<li class="list-group-item bg-default response">
<strong>Response <code>200</code></strong>
<a href="javascript:;" class="pull-right btn btn-default btn-sm snippet-toggle" data-target="response-snippet"><small>SHOW</small></a>
</li>
<li class="list-group-item response-snippet" style="list-style: none">
<code>&lt; Content-Type: application/json</code><br>
<pre class="prettyprint">{
&#34;data&#34;: {
&#34;id&#34;: &#34;1&#34;, // note this is a string
&#34;user&#34;: {
...
},
&#34;created_at&#34;: &#34;2012-07-16T17:25:47Z&#34;,
&#34;text&#34;: &#34;@berg FIRST post on this new site #newsocialnetwork&#34;,
&#34;source&#34;: {
&#34;client_id&#34;: &#34;udxGzAVBdXwGtkHmvswR5MbMEeVnq6n4&#34;,
&#34;name&#34;: &#34;Clientastic for iOS&#34;,
&#34;link&#34;: &#34;http://app.net&#34;
},
&#34;machine_only&#34;: false,
&#34;reply_to&#34;: null,
&#34;thread_id&#34;: &#34;1&#34;,
&#34;num_replies&#34;: 3,
&#34;num_reposts&#34;: 0,
&#34;num_stars&#34;: 0,
&#34;entities&#34;: {
&#34;mentions&#34;: [{
&#34;name&#34;: &#34;berg&#34;,
&#34;id&#34;: &#34;2&#34;,
&#34;pos&#34;: 0,
&#34;len&#34;: 5
}],
&#34;hashtags&#34;: [{
&#34;name&#34;: &#34;newsocialnetwork&#34;,
&#34;pos&#34;: 34,
&#34;len&#34;: 17
}],
&#34;links&#34;: [{
&#34;text&#34;: &#34;this new site&#34;,
&#34;url&#34;: &#34;https://join.app.net&#34;
&#34;pos&#34;: 20,
&#34;len&#34;: 13
}]
},
&#34;you_reposted&#34;: false,
&#34;you_starred&#34;: false
},
&#34;meta&#34;: {
&#34;code&#34;: 200,
}
}
</pre>
</li>
</ul>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<span class="btn btn-danger">DELETE</span>
<code>/stream/0/posts/{post_id}</code>
</div>
<div class="panel-body">
<p>Delete a Post. The current user must be the same user who created the Post. It returns the deleted Post on success.</p>
</div>
<ul class="list-group">
<li class="list-group-item bg-default"><strong>Parameters</strong></li>
<li class="list-group-item">
<dl class="dl-horizontal">
<dt>post_id</dt>
<dd>
<strong>(required)</strong>
<code>string</code> The id of the Post.
</dd>
</dl>
</li>
<li class="list-group-item bg-default response">
<strong>Response <code>204</code></strong>
</li>
<li class="list-group-item response-snippet" style="list-style: none">
</li>
</ul>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<span class="btn btn-success">POST</span>
<code>/stream/0/posts</code>
</div>
<div class="panel-body">
<p>Create a new Post object. Mentions and hashtags will be parsed out of the post text, as will bare URLs&hellip;</p>
</div>
<ul class="list-group">
<li class="list-group-item bg-default response">
<strong>Requests</strong>
<a href="javascript:;" class="pull-right btn btn-default btn-sm snippet-toggle" data-target="request-snippet"><small>SHOW</small></a>
</li>
<li class="list-group-item request-snippet" style="display: none">
<code>&gt; Content-Type: application/json</code><br>
<pre class="prettyprint">{
&#34;data&#34;: {
&#34;id&#34;: &#34;1&#34;, // note this is a string
&#34;user&#34;: {
...
},
&#34;created_at&#34;: &#34;2012-07-16T17:25:47Z&#34;,
&#34;text&#34;: &#34;@berg FIRST post on this new site #newsocialnetwork&#34;,
&#34;source&#34;: {
&#34;client_id&#34;: &#34;udxGzAVBdXwGtkHmvswR5MbMEeVnq6n4&#34;,
&#34;name&#34;: &#34;Clientastic for iOS&#34;,
&#34;link&#34;: &#34;http://app.net&#34;
},
&#34;machine_only&#34;: false,
&#34;reply_to&#34;: null,
&#34;thread_id&#34;: &#34;1&#34;,
&#34;num_replies&#34;: 3,
&#34;num_reposts&#34;: 0,
&#34;num_stars&#34;: 0,
&#34;entities&#34;: {
&#34;mentions&#34;: [{
&#34;name&#34;: &#34;berg&#34;,
&#34;id&#34;: &#34;2&#34;,
&#34;pos&#34;: 0,
&#34;len&#34;: 5
}],
&#34;hashtags&#34;: [{
&#34;name&#34;: &#34;newsocialnetwork&#34;,
&#34;pos&#34;: 34,
&#34;len&#34;: 17
}],
&#34;links&#34;: [{
&#34;text&#34;: &#34;this new site&#34;,
&#34;url&#34;: &#34;https://join.app.net&#34;
&#34;pos&#34;: 20,
&#34;len&#34;: 13
}]
},
&#34;you_reposted&#34;: false,
&#34;you_starred&#34;: false
},
&#34;meta&#34;: {
&#34;code&#34;: 200,
}
}
</pre>
</li>
<li class="list-group-item bg-default response">
<strong>Response <code>201</code></strong>
<a href="javascript:;" class="pull-right btn btn-default btn-sm snippet-toggle" data-target="response-snippet"><small>SHOW</small></a>
</li>
<li class="list-group-item response-snippet" style="list-style: none">
<code>&lt; Content-Type: application/json</code><br>
<pre class="prettyprint">{
&#34;data&#34;: {
&#34;id&#34;: &#34;1&#34;, // note this is a string
&#34;user&#34;: {
...
},
&#34;created_at&#34;: &#34;2012-07-16T17:25:47Z&#34;,
&#34;text&#34;: &#34;@berg FIRST post on this new site #newsocialnetwork&#34;,
&#34;source&#34;: {
&#34;client_id&#34;: &#34;udxGzAVBdXwGtkHmvswR5MbMEeVnq6n4&#34;,
&#34;name&#34;: &#34;Clientastic for iOS&#34;,
&#34;link&#34;: &#34;http://app.net&#34;
},
&#34;machine_only&#34;: false,
&#34;reply_to&#34;: null,
&#34;thread_id&#34;: &#34;1&#34;,
&#34;num_replies&#34;: 3,
&#34;num_reposts&#34;: 0,
&#34;num_stars&#34;: 0,
&#34;entities&#34;: {
&#34;mentions&#34;: [{
&#34;name&#34;: &#34;berg&#34;,
&#34;id&#34;: &#34;2&#34;,
&#34;pos&#34;: 0,
&#34;len&#34;: 5
}],
&#34;hashtags&#34;: [{
&#34;name&#34;: &#34;newsocialnetwork&#34;,
&#34;pos&#34;: 34,
&#34;len&#34;: 17
}],
&#34;links&#34;: [{
&#34;text&#34;: &#34;this new site&#34;,
&#34;url&#34;: &#34;https://join.app.net&#34;
&#34;pos&#34;: 20,
&#34;len&#34;: 13
}]
},
&#34;you_reposted&#34;: false,
&#34;you_starred&#34;: false
},
&#34;meta&#34;: {
&#34;code&#34;: 200,
}
}
</pre>
</li>
</ul>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<span class="btn btn-primary">GET</span>
<code>/stream/0/posts</code>
</div>
<div class="panel-body">
<p>Retrieves all posts.</p>
</div>
<ul class="list-group">
<li class="list-group-item bg-default response">
<strong>Response <code>200</code></strong>
<a href="javascript:;" class="pull-right btn btn-default btn-sm snippet-toggle" data-target="response-snippet"><small>SHOW</small></a>
</li>
<li class="list-group-item response-snippet" style="list-style: none">
<code>&lt; Content-Type: application/json</code><br>
<pre class="prettyprint">{
[&#34;data&#34;: {
&#34;id&#34;: &#34;1&#34;, // note this is a string
&#34;user&#34;: {
...
},
&#34;created_at&#34;: &#34;2012-07-16T17:25:47Z&#34;,
&#34;text&#34;: &#34;@berg FIRST post on this new site #newsocialnetwork&#34;,
&#34;source&#34;: {
&#34;client_id&#34;: &#34;udxGzAVBdXwGtkHmvswR5MbMEeVnq6n4&#34;,
&#34;name&#34;: &#34;Clientastic for iOS&#34;,
&#34;link&#34;: &#34;http://app.net&#34;
},
&#34;machine_only&#34;: false,
&#34;reply_to&#34;: null,
&#34;thread_id&#34;: &#34;1&#34;,
&#34;num_replies&#34;: 3,
&#34;num_reposts&#34;: 0,
&#34;num_stars&#34;: 0,
&#34;entities&#34;: {
&#34;mentions&#34;: [{
&#34;name&#34;: &#34;berg&#34;,
&#34;id&#34;: &#34;2&#34;,
&#34;pos&#34;: 0,
&#34;len&#34;: 5
}],
&#34;hashtags&#34;: [{
&#34;name&#34;: &#34;newsocialnetwork&#34;,
&#34;pos&#34;: 34,
&#34;len&#34;: 17
}],
&#34;links&#34;: [{
&#34;text&#34;: &#34;this new site&#34;,
&#34;url&#34;: &#34;https://join.app.net&#34;
&#34;pos&#34;: 20,
&#34;len&#34;: 13
}]
},
&#34;you_reposted&#34;: false,
&#34;you_starred&#34;: false
},
&#34;meta&#34;: {
&#34;code&#34;: 200,
}],
...
}
</pre>
</li>
</ul>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<span class="btn btn-success">POST</span>
<code>/stream/0/posts/{post_id}/star</code>
</div>
<div class="panel-body">
<p>Save a given Post to the current User’s stars. This is just a “save” action, not a sharing action.</p>
<p><em>Note: A repost cannot be starred. Please star the parent Post.</em></p>
</div>
<ul class="list-group">
<li class="list-group-item bg-default"><strong>Parameters</strong></li>
<li class="list-group-item">
<dl class="dl-horizontal">
<dt>post_id</dt>
<dd>
<strong>(required)</strong>
<code>string</code> The id of the Post.
</dd>
</dl>
</li>
<li class="list-group-item bg-default response">
<strong>Response <code>200</code></strong>
<a href="javascript:;" class="pull-right btn btn-default btn-sm snippet-toggle" data-target="response-snippet"><small>SHOW</small></a>
</li>
<li class="list-group-item response-snippet" style="list-style: none">
<code>&lt; Content-Type: application/json</code><br>
<pre class="prettyprint">{
&#34;data&#34;: {
&#34;id&#34;: &#34;1&#34;, // note this is a string
&#34;user&#34;: {
...
},
&#34;created_at&#34;: &#34;2012-07-16T17:25:47Z&#34;,
&#34;text&#34;: &#34;@berg FIRST post on this new site #newsocialnetwork&#34;,
&#34;source&#34;: {
&#34;client_id&#34;: &#34;udxGzAVBdXwGtkHmvswR5MbMEeVnq6n4&#34;,
&#34;name&#34;: &#34;Clientastic for iOS&#34;,
&#34;link&#34;: &#34;http://app.net&#34;
},
&#34;machine_only&#34;: false,
&#34;reply_to&#34;: null,
&#34;thread_id&#34;: &#34;1&#34;,
&#34;num_replies&#34;: 3,
&#34;num_reposts&#34;: 0,
&#34;num_stars&#34;: 0,
&#34;entities&#34;: {
&#34;mentions&#34;: [{
&#34;name&#34;: &#34;berg&#34;,
&#34;id&#34;: &#34;2&#34;,
&#34;pos&#34;: 0,
&#34;len&#34;: 5
}],
&#34;hashtags&#34;: [{
&#34;name&#34;: &#34;newsocialnetwork&#34;,
&#34;pos&#34;: 34,
&#34;len&#34;: 17
}],
&#34;links&#34;: [{
&#34;text&#34;: &#34;this new site&#34;,
&#34;url&#34;: &#34;https://join.app.net&#34;
&#34;pos&#34;: 20,
&#34;len&#34;: 13
}]
},
&#34;you_reposted&#34;: false,
&#34;you_starred&#34;: false
},
&#34;meta&#34;: {
&#34;code&#34;: 200,
}
}
</pre>
</li>
</ul>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<span class="btn btn-danger">DELETE</span>
<code>/stream/0/posts/{post_id}/star</code>
</div>
<div class="panel-body">
<p>Remove a Star from a Post.</p>
</div>
<ul class="list-group">
<li class="list-group-item bg-default"><strong>Parameters</strong></li>
<li class="list-group-item">
<dl class="dl-horizontal">
<dt>post_id</dt>
<dd>
<strong>(required)</strong>
<code>string</code> The id of the Post.
</dd>
</dl>
</li>
<li class="list-group-item bg-default response">
<strong>Response <code>200</code></strong>
<a href="javascript:;" class="pull-right btn btn-default btn-sm snippet-toggle" data-target="response-snippet"><small>SHOW</small></a>
</li>
<li class="list-group-item response-snippet" style="list-style: none">
<code>&lt; Content-Type: application/json</code><br>
<pre class="prettyprint">{
&#34;data&#34;: {
&#34;id&#34;: &#34;1&#34;, // note this is a string
&#34;user&#34;: {
...
},
&#34;created_at&#34;: &#34;2012-07-16T17:25:47Z&#34;,
&#34;text&#34;: &#34;@berg FIRST post on this new site #newsocialnetwork&#34;,
&#34;source&#34;: {
&#34;client_id&#34;: &#34;udxGzAVBdXwGtkHmvswR5MbMEeVnq6n4&#34;,
&#34;name&#34;: &#34;Clientastic for iOS&#34;,
&#34;link&#34;: &#34;http://app.net&#34;
},
&#34;machine_only&#34;: false,
&#34;reply_to&#34;: null,
&#34;thread_id&#34;: &#34;1&#34;,
&#34;num_replies&#34;: 3,
&#34;num_reposts&#34;: 0,
&#34;num_stars&#34;: 0,
&#34;entities&#34;: {
&#34;mentions&#34;: [{
&#34;name&#34;: &#34;berg&#34;,
&#34;id&#34;: &#34;2&#34;,
&#34;pos&#34;: 0,
&#34;len&#34;: 5
}],
&#34;hashtags&#34;: [{
&#34;name&#34;: &#34;newsocialnetwork&#34;,
&#34;pos&#34;: 34,
&#34;len&#34;: 17
}],
&#34;links&#34;: [{
&#34;text&#34;: &#34;this new site&#34;,
&#34;url&#34;: &#34;https://join.app.net&#34;
&#34;pos&#34;: 20,
&#34;len&#34;: 13
}]
},
&#34;you_reposted&#34;: false,
&#34;you_starred&#34;: false
},
&#34;meta&#34;: {
&#34;code&#34;: 200,
}
}
</pre>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
<script>
jQuery(function($) {
$('#group-tab a:first').tab('show');
$('.snippet-toggle').on("click", function(e) {
e.preventDefault();
var target = $(this).data('target');
$(this).parent().parent().find('.' + target).toggle();
if ($(this).text() == "SHOW") {
$(this).text("HIDE");
} else {
$(this).text("SHOW");
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment