Gist Fox API is a pastes service similar to GitHub’s Gist.
Gist Fox API uses OAuth Authorization. First you create a new (or acquire existing) OAuth token using Basic Authentication. After you have acquired your token you can use it to access other resources within token’ scope.
Where applicable this API uses the HAL+JSON media-type to represent resources states and affordances.
Requests with a message-body are using plain JSON to set or update resource states.
The common HTTP Response Status Codes are used.
Press the letter T on your keyboard to return to the table of contents.
Gist Fox API entry point.
This resource does not have any attributes. Instead it offers the initial API affordances in the form of the HTTP Link header and HAL links.
GET /
{
"_links": {
"self": { "href": "/" },
"gists": { "href": "/gists?{since}", "templated": true },
"authorization": { "href": "/authorization"}
}
}
Gist-related resources of Gist Fox API.
A single Gist object. The Gist resource is the central resource in the Gist Fox API. It represents one paste - a single text note.
The Gist resource has the following attributes:
id
created_at
description
content
The states id and created_at are assigned by the Gist Fox API at the moment of creation.
ID of the Gist in the form of a hash.
Gist Fox API access token.
GET /gists/{id}{?access_token}
HAL+JSON representation of Gist Resource. In addition to representing its state in the JSON form it offers affordances in the form of the HTTP Link header and HAL links.
{
"_links": {
"self": { "href": "/gists/42" },
"star": { "href": "/gists/42/star" },
},
"id": "42",
"created_at": "2014-04-14T02:15:15Z",
"description": "Description of Gist",
"content": "String contents"
}
To update a Gist send a JSON with updated value for one or more of the Gist resource attributes. All attributes values (states) from the previous version of this Gist are carried over by default if not included in the hash.
PATCH /gists/{id}{?access_token}
application/json
{
"content": "Updated file contents"
}
HAL+JSON representation of Gist Resource. In addition to representing its state in the JSON form it offers affordances in the form of the HTTP Link header and HAL links.
{
"_links": {
"self": { "href": "/gists/42" },
"star": { "href": "/gists/42/star" },
},
"id": "42",
"created_at": "2014-04-14T02:15:15Z",
"description": "Description of Gist",
"content": "String contents"
}
DELETE /gists/{id}{?access_token}
Collection of all Gists.
The Gist Collection resource has the following attribute:
In addition it embeds Gist Resources in the Gist Fox API.
GET /gists{?access_token,since}
Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
Only gists updated at or after this time are returned.
HAL+JSON representation of Gist Collection Resource. The Gist resources in collections are embedded. Note the embedded Gists resource are incomplete representations of the Gist in question. Use the respective Gist link to retrieve its full representation.
{
"_links": {
"self": { "href": "/gists" }
},
"_embedded": {
"gists": [
{
"_links" : {
"self": { "href": "/gists/42" }
},
"id": "42",
"created_at": "2014-04-14T02:15:15Z",
"description": "Description of Gist"
}
]
},
"total": 1
}
To create a new Gist simply provide a JSON hash of the description and content attributes for the new Gist.
This action requires an access_token
with gist_write
scope.
POST /gists{?access_token,since}
application/json
Gist Fox API access token.
{
"description": "Description of Gist",
"content": "String content"
}
HAL+JSON representation of Gist Resource. In addition to representing its state in the JSON form it offers affordances in the form of the HTTP Link header and HAL links.
{
"_links": {
"self": { "href": "/gists/42" },
"star": { "href": "/gists/42/star" },
},
"id": "42",
"created_at": "2014-04-14T02:15:15Z",
"description": "Description of Gist",
"content": "String contents"
}
Star resource represents a Gist starred status.
The Star resource has the following attribute:
ID of the gist in the form of a hash
Gist Fox API access token.
This action requires an access_token
with gist_write
scope.
PUT /gists/{id}/star{?access_token}
This action requires an access_token
with gist_write
scope.
DELETE /gists/{id}/star{?access_token}
GET /gists/{id}/star{?access_token}
HAL+JSON representation of Star Resource.
{
"_links": {
"self": { "href": "/gists/42/star" },
},
"starred": true
}
Access and Control of Gist Fox API OAuth token.
Authorization Resource represents an authorization granted to the user. You can only access your own authorization, and only through Basic Authentication.
The Authorization Resource has the following attribute:
token
scopes
Where token represents an OAuth token and scopes is an array of scopes granted for the given authorization. At this moment the only available scope is gist_write
.
GET /authorization
Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
{
"_links": {
"self": { "href": "/authorizations" },
},
"scopes": [
"gist_write"
],
"token": "abc123"
}
POST /authorization
application/json
Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
{
"scopes": [
"gist_write"
]
}
DELETE /authorization
Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==