Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
mneumegen committed Jan 28, 2015
0 parents commit 3829869
Show file tree
Hide file tree
Showing 29 changed files with 2,285 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_site/
.sass-cache/
55 changes: 55 additions & 0 deletions _api/1_1_books_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: /books
type: get
description: List all books
parameters:
title: List Book Format
data:
- offset:
- integer
- Offset the results by this amount
- limit:
- integer
- Limit the number of books returned
right_code:
return: |
[
{
"id": 1,
"title": "The Hunger Games",
"score": 4.5,
"date_added": "12/12/2013"
},
{
"id": 1,
"title": "The Hunger Games",
"score": 4.7,
"date_added": "15/12/2013"
},
]
---

<p> Lists all the photos you have access to. You can paginate by using the parameters listed above. </p>

<div class="code-viewer">
<pre data-language="jQuery">
$.get('http://api.myapp.com/books/', { token: 'YOUR_APP_KEY'}, function(data) {
alert(data);
});</pre>

<pre data-language="Python">
r = requests.get('http://api.myapp.com/books/', token="YOUR_APP_KEY")
print r.text</pre>

<pre data-language="Node">
var request = require('request');
request('http://api.myapp.com/books?token=YOUR_APP_KEY', function (error, response, body) {
if (!error &amp;&amp; response.statusCode == 200) {
console.log(body);
}
})</pre>

<pre data-language="cURL">
curl http://sampleapi.readme.com/orders?key=YOUR_APP_KEY</pre>

</div>
35 changes: 35 additions & 0 deletions _api/1_2_books_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: /books
type: post
description: Create Book
parameters:
title: Create Book Format
data:
- title:
- string
- The title for the book
- score:
- float
- The book's score between 0 and 5
right_code:
response: |
{
"id": 3,
"title": "The Book Thief",
"score": 4.3,
"date_added": "5/1/2015"
}
---

Adds a book to your collection.

<div class="code-viewer">
<pre data-language="jQuery">
$.post('http://api.myapp.com/books/', {
token: 'YOUR_APP_KEY',
title: "The Book Thief",
score: 4.3
}, function(data) {
alert(data);
});</pre>
</div>
24 changes: 24 additions & 0 deletions _api/1_3_books_get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: /books/:id
type: get
description: Get Book
right_code:
response: |
{
"id": 3,
"title": "The Book Thief",
"score": 4.3,
"date_added": "5/1/2015"
}
---

Returns a specific book from your collection

<div class="code-viewer">
<pre data-language="jQuery">
$.get('http://api.myapp.com/books/3', {
token: 'YOUR_APP_KEY',
}, function(data) {
alert(data);
});</pre>
</div>
39 changes: 39 additions & 0 deletions _api/1_4_books_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: /books/:id
type: put
description: Update Book
parameters:
title: Update Book Format
data:
- title:
- string
- The title for the book
- score:
- float
- The book's score between 0 and 5
right_code:
response: |
{
"id": 3,
"title": "The Book Stealer",
"score": 5,
"date_added": "5/1/2015"
}
---

Update an existing book in your collection.

<div class="code-viewer">
<pre data-language="jQuery">
$.ajax({
url: 'http://api.myapp.com/books/3'
type: 'PUT',
data: {
token: 'YOUR_APP_KEY',
score: 5.0,
title: "The Book Stealer"
},
success: function(data) {
alert(data);
});</pre>
</div>
25 changes: 25 additions & 0 deletions _api/1_5_books_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: /books/:id
type: delete
description: Deletes a book
right_code:
response: |
{
"id": 3,
"status": "deleted"
}
---
Deletes a book in your collection.

<div class="code-viewer">
<pre data-language="jQuery">
$.ajax({
url: 'http://api.myapp.com/books/3'
type: 'DELETE',
data: {
token: 'YOUR_APP_KEY'
},
success: function(data) {
alert(data);
});</pre>
</div>
7 changes: 7 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
collections:
documentation:
title: Documentation
render: true
api:
title: APIs
render: true
18 changes: 18 additions & 0 deletions _documentation/1_getting_started.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Getting Started
description: An intro to our API
right_code:
---


<p> Welcome to our API! </p>

<p> This API document is designed for those interested in developing for our platform. </p>

<div class="warning message-box">
<h5>Warning</h5>

<p> Something terrible will happen if you try and do this. </p>
</div>

<p> This API is still under development and will evolve. </p>
20 changes: 20 additions & 0 deletions _documentation/2_authentication.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Authentication
right_code:
jQuery: |
$.get('http://api.myapp.com/books/', { token: 'YOUR_APP_KEY'}, function(data) {
alert(data);
});
cURL: |
curl http://api.myapp.com/books?token=YOUR_APP_KEY
---

<p> You need to be authenticated for all API requests. You can generate an API key in your developer dashboard. </p>

<p> Add the API key to all requests as a GET parameter. </p>

<div class="alert message-box">
<h5>Uh ohhh</h5>

<p>Nothing will work unless you include this API key.</p>
</div>
46 changes: 46 additions & 0 deletions _documentation/3_errors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Errors
description: These are all the errors the API could return

---
<table class="return_codes">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="return-code">200</span></td>
<td>OK</td>
<td>Success</td>
</tr>
<tr>
<td><span class="return-code">201</span></td>
<td>Created</td>
<td>Creation successful</td>
</tr>

<tr>
<td><span class="return-code">400</span></td>
<td>Bad Request</td>
<td>We could not process that action</td>
</tr>

<tr>
<td><span class="return-code">403</span></td>
<td>Forbidden</td>
<td>We couldn't authenticate you</td>
</tr>
</tbody>
</table>

<p> All errors will return JSON in the following format: </p>

<pre>
{
error: true,
message: "error message here"
}</pre>
17 changes: 17 additions & 0 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div id="sidebar" class="sidebar">
{% for collection in site.collections %}
{% if collection[1].render %}
<section>
<h6> {{collection[1].title}} </h6>
<ul>
{% for doc in collection[1].docs %}
<li><a href="#{{doc.url | replace: '/', '' | replace: '.', ''}}">
{{doc.title}}
{% if doc.type %}<span class="endpoint {{doc.type}}"></span> {% endif %}
</a></li>
{% endfor %}
</ul>
</section>
{% endif %}
{% endfor %}
</div>
48 changes: 48 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{page.title}}</title>
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<!-- <link rel="icon" type="image/png" href="images/favicon.png"> -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="/js/main.js"></script>

<link rel="stylesheet" href="/css/tomorrow.css">
<link rel="stylesheet" href="/css/railscasts.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
</head>
<body class="{{page.body_class}}">

<nav class="nav-bar">
<ul class="hor">
<li> <a href="/" class="logo"><img src="/img/log.png" alt="logo" height="20" /></a> </li>
{% assign current = page.url %}
<li> <a href="/"
{% if current == '/index.html' %}
class="current"
{% endif %}
> Documentation </a> </li>
<li> <a href="/index2.html"
{% if current == '/index2.html' %}
class="current"
{% endif %}
> 2nd layout </a> </li>
</ul>

<ul class="right hor">
<li><input type="text" name="search" id="search" class="search-box" placeholder="Search"><div id="search_results" class="search-results"></div></li>

</ul>
</nav>
{% if page.sidebar %}
{% include sidebar.html %}
{% endif %}
<div class="main">
{{content}}
</div>
</body>
</html>
4 changes: 4 additions & 0 deletions _more/1_twitter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: Twitter (@orderapi)
link: '#'
---
4 changes: 4 additions & 0 deletions _more/2_email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: Email ([email protected])
link: '#'
---
Loading

0 comments on commit 3829869

Please sign in to comment.