This document defines the REST API specifications for Sticky Notes. The API has
three main endpoints: create
, show
and list
and a utility endpoint called parameter
. For each endpoint, there is
a set of mandatory and optional parameters and a standard output template depending
upon the requested format for the response.
You can find an implementation of the REST API in the api-client branch on GitHub.
The create
endpoint can be used for creating a new paste from your
application.
http://yoursite.com/api/<format>/create
format
:
Can be json
or xml
.
For example: http://yoursite.com/api/json/create
is a valid endpoint
POST
data
:
The text to be pasted
language
:
The development language used (see parameter endpoint)
title
:
The paste title
private
:
Set to true
for private pastes. Do not send this param for public pastes
password
:
A password string to protect the paste
expire
:
Time in minutes after which paste will be deleted from server
(see parameter endpoint)
project
:
Whether to associate the paste with a project (click
here for more information)
id
:
ID of the paste
hash
:
Hash/key for the paste (only for private pastes)
http://yoursite.com/<id>
for public pastes and
http://yoursite.com/<id>/<hash>
for private pastes.
err_cannot_post
:
The site has disabled public posting
err_title_max_30
:
Title cannot be longer than 30 characters
err_data_required
:
Paste body was not sent
err_data_too_big
:
Paste body exceeds maximum size configured for the site
err_lang_required
:
Paste language was not specified
err_lang_invalid
:
An invalid language was used
err_expire_integer
:
The paste expiration value must be an integer
err_expire_invalid
:
An invalid expiration time was used
The show
endpoint can be used for returning a paste by its unique
identifier.
http://yoursite.com/api/<format>/show/<id>/<hash>/<password>
format
:
Can be json
or xml
id
:
The unique paste identifier
hash
:
Hash/key for the paste (only for private pastes)
password
:
Password to unlock the paste (only for protected pastes)
GET
id
:
ID of the paste
author
:
Author of the paste
timestamp
:
UNIX timestamp representing paste creation time
language
:
Language of the paste data
title
:
The paste title
data
:
The pasted code
project
:
Project name (if any) associated with the paste
hits
:
Number of views
err_not_found
:
Paste not found
err_invalid_hash
:
Invalid hash code for a private paste
err_password_required
:
Password required to view the paste
err_invalid_password
:
Incorrect password supplied
The list
endpoint can be used for getting a list of pastes IDs.
http://yoursite.com/api/<format>/list/<page>
format
:
Can be json
or xml
page
:
The list page to be fetched
GET
pastes
:
Contains sub-elements containing paste IDs
count
:
Number of paste elements enclosed within pastes
pages
:
Total number of pages
err_no_pastes
:
No pastes found
The parameter
endpoint will provide you a list of values
associated with a specific parameter. The parameters might be used as an
input to certain API endpoints, or can purely be for informational purposes.
http://yoursite.com/api/<format>/parameter/<param>
format
:
Can be json
or xml
param
:
The parameter whose values are to be listed. Currently supports the following parameters:
expire
:
The paste expire timestamps
language
:
The paste language parameter
version
:
Sticky Notes installed version
theme
:
Name of the active theme on the site
GET
values
:
Contains a list of accepted parameter values
err_invalid_param
:
Value list not available for specified parameter