Permalink
Browse files

Adapt site for my needs ;)

  • Loading branch information...
drogus committed Oct 12, 2011
1 parent 3eae3e7 commit ddf5a7d83297090ccffba00c0734bc4303ac82ec
View
@@ -1,43 +1,7 @@
---
-title: GitHub API
+title: Stoliczku API
---
-# The GitHub API
+# Stoliczku API
-This describes the resources that make up the official GitHub API v3. If
-you have any problems or requests please contact
-[support](mailto:support@github.com?subject=APIv3).
-
-For the new API v3, start browsing the resources on the right >>
-
-## Breaking BETA Changes
-
-We're making some small tweaks to the API during the BETA phase. Old
-behavior will be supported until the dates listed below. Please be sure
-to update your app in time.
-
-### Behavior due to be removed by July 20th:
-
-* `integrate_branch` on the [repo API](/v3/repos/#get) will no longer be
- returned.
-
-### Changelog for breaking changes
-
-#### Removed on June 15th:
-
-* `gravatar_url` is being deprecated in favor of `avatar_url` for all
- responses that include users or orgs. A default size is no longer
- included in the url.
-* Creating new gists (both anonymously and with an authenticated user)
- should use `POST /gists` from now on. `POST /users/:user/gists` is no
- longer supported.
-
-#### Removed on June 1st:
-
-* Removed support for PUT verb on update requests. Use POST or PATCH
- instead.
-* Removed `.json` extension from all URLs.
-* No longer using the X-Next or X-Last headers. Pagination info is
- returned in the Link header instead.
-* JSON-P response has completely changed to a more consistent format.
-* Starring gists now uses PUT verb (instead of POST) and returns 204.
+...
View
@@ -1,286 +0,0 @@
----
-title: GitHub API v3
----
-
-# API v3
-
-This describes the resources that make up the official GitHub API v3. If
-you have any problems or requests please contact
-[support](mailto:support@github.com?subject=APIv3).
-
-**Note:** This API is in a beta state. Breaking changes may occur.
-
-* <a href="#schema">Schema</a>
-* <a href="#client-errors">Client Errors</a>
-* <a href="#http-verbs">HTTP Verbs</a>
-* <a href="#authentication">Authentication</a>
-* <a href="#pagination">Pagination</a>
-* <a href="#rate-limiting">Rate Limiting</a>
-* <a href="#cross-origin-resource-sharing">Cross Origin Resource Sharing</a>
-* <a href="#json-p-callbacks">JSON-P Callbacks</a>
-
-## Schema
-
-All API access is over HTTPS, and accessed from the `api.github.com`
-domain. All data is sent and received as JSON.
-
-<pre class="terminal">
-$ curl -i https://api.github.com
-
-HTTP/1.1 200 OK
-Content-Type: application/json
-Status: 200 OK
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4999
-Content-Length: 2
-
-{}
-</pre>
-
-Blank fields are included as `null` instead of being omitted.
-
-All timestamps are returned in ISO 8601 format:
-
- YYYY-MM-DDTHH:MM:SSZ
-
-## Client Errors
-
-There are three possible types of client errors on API calls that
-receive request bodies:
-
-1. Sending invalid JSON will result in a `400 Bad Request` response.
-
- HTTP/1.1 400 Bad Request
- Content-Length: 35
-
- {"message":"Problems parsing JSON"}
-
-2. Sending the wrong type of JSON values will result in a `400 Bad
- Request` response.
-
- HTTP/1.1 400 Bad Request
- Content-Length: 40
-
- {"message":"Body should be a JSON Hash"}
-
-3. Sending invalid files will result in a 422 Unprocessable Entity
- response.
-
- HTTP/1.1 422 Unprocessable Entity
- Content-Length: 149
-
- {
- "message": "Validation Failed",
- "errors": [
- {
- "resource": "Issue",
- "field": "title",
- "code": "missing_field"
- }
- ]
- }
-
-All error objects have resource and field properties so that your client
-can tell what the problem is. There's also an error code to let you
-know what is wrong with the field. These are the possible validation error
-codes:
-
-missing
-: This means a resource does not exist.
-
-missing\_field
-: This means a required field on a resource has not been set.
-
-invalid
-: This means the formatting of a field is invalid. The documentation
-for that resource should be able to give you more specific information.
-
-already\_exists
-: This means another resource has the same value as this field. This
-can happen in resources that must have some unique key (such as Label
-names).
-
-## HTTP Verbs
-
-Where possible, API v3 strives to use appropriate HTTP verbs for each
-action.
-
-HEAD
-: Can be issued against any resource to get just the HTTP header info.
-
-GET
-: Used for retrieving resources.
-
-POST
-: Used for creating resources, or performing custom actions (such as
-merging a pull request).
-
-PATCH
-: Used for updating resources with partial JSON data. For instance, an
-Issue resource has `title` and `body` attributes. A PATCH request may
-accept one or more of the attributes to update the resource. PATCH is a
-relatively new and uncommon HTTP verb, so resource endpoints also accept
-POST requests.
-
-PUT
-: Used for replacing resources or collections.
-
-DELETE
-: Used for deleting resources.
-
-## Authentication
-
-There are two ways to authenticate through GitHub API v3:
-
-Basic Authentication:
-
-<pre class="terminal">
-$ curl -u "username:PASSWORD" https://api.github.com
-</pre>
-
-OAuth2 Token (sent in a header):
-
-<pre class="terminal">
-$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
-</pre>
-
-OAuth2 Token (sent as a parameter):
-
-<pre class="terminal">
-$ curl https://api.github.com?access_token=OAUTH-TOKEN
-</pre>
-
-Read [more about OAuth2](/v3/oauth/).
-
-## Pagination
-
-Requests that return multiple items will be paginated to 30 items by
-default. You can specify further pages with the `?page` parameter. You
-can also set a custom page size up to 100 with the `?per_page` parameter.
-
-<pre class="terminal">
-$ curl https://api.github.com/repos?page=2&per_page=100
-</pre>
-
-The pagination info is included in [the Link header](http://www.w3.org/Protocols/9707-link-header.html):
-
- Link: <https://api.github.com/repos?page=3&per_page=100>; rel="next",
- <https://api.github.com/repos?page=50&per_page=100>; rel="last"
-
-_Linebreak is included for readability._
-
-The possible `rel` values are:
-
-`next`
-: Shows the URL of the immediate next page of results.
-
-`last`
-: Shows the URL of the last page of results.
-
-`first`
-: Shows the URL of the first page of results.
-
-`prev`
-: Shows the URL of the immediate previous page of results.
-
-## Rate Limiting
-
-We limit requests to API v3 to 5000 per hour. This is keyed off either your
-login, your OAuth token, or request IP. You can check the returned HTTP
-headers of any API request to see your current status:
-
-<pre class="terminal">
-$ curl -i https://api.github.com/users/whatever
-
-HTTP/1.1 200 OK
-Status: 200 OK
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4966
-</pre>
-
-You can file a [support issue](http://support.github.com/dashboard/queues/2386-api)
-to request white listed access for your application. We prefer sites that
-setup OAuth applications for their users.
-
-## Cross Origin Resource Sharing
-
-The API supports Cross Origin Resource Sharing (CORS) for AJAX requests.
-you can read the [CORS W3C working draft](http://www.w3.org/TR/cors), or
-[this intro](http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity) from the
-HTML 5 Security Guide.
-
-Here's a sample request sent from a browser hitting
-`http://some-site.com`:
-
- $ curl -i https://api.github.com -H "Origin: http://some-site.com"
- HTTP/1.1 302 Found
-
-Any domain that is registered as an OAuth Application is accepted.
-Here's a sample request for a browser hitting [Calendar About Nothing](http://calendaraboutnothing.com/):
-
- $ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com"
- HTTP/1.1 302 Found
- Access-Control-Allow-Origin: http://calendaraboutnothing.com
- Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
- Access-Control-Allow-Credentials: true
-
-This is what the CORS preflight request looks like:
-
- $ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com" -X OPTIONS
- HTTP/1.1 204 No Content
- Access-Control-Allow-Origin: http://calendaraboutnothing.com
- Access-Control-Allow-Headers: Authorization, X-Requested-With
- Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE
- Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
- Access-Control-Max-Age: 86400
- Access-Control-Allow-Credentials: true
-
-## JSON-P Callbacks
-
-You can send a `?callback` parameter to any GET call to have the results
-wrapped in a JSON function. This is typically used when browsers want
-to embed GitHub content in web pages by getting around cross domain
-issues. The response includes the same data output as the regular API,
-plus the relevant HTTP Header information.
-
-<pre class="terminal">
-$ curl https://api.github.com?callback=foo
-
-foo({
- "meta": {
- "status": 200,
- "X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4966",
- "Link": [ // pagination headers and other links
- ["https://api.github.com?page=2", {"rel": "next"}]
- ]
- },
- "data": {
- // the data
- }
-})
-</pre>
-
-You can write a javascript handler to process the callback like this:
-
-<pre class="highlight"><code class="language-javascript">function foo(response) {
- var meta = response.meta
- var data = response.data
- console.log(meta)
- console.log(data)
-}</code></pre>
-
-All of the headers are the same String value as the HTTP Headers with one
-notable exception: Link. Link headers are pre-parsed for you and come
-through as an array of `[url, options]` tuples.
-
-A link that looks like this:
-
- Link: <url1>; rel="next", <url2>; rel="foo"; bar="baz"
-
-... will look like this in the Callback output:
-
-<%= json "Link" => [
- ["url1", {:rel => "next"}],
- ["url2", {:rel => "foo", :bar => "baz"}]] %>
-
Oops, something went wrong.

0 comments on commit ddf5a7d

Please sign in to comment.