My favorites | Sign in
Project Logo
                
REST_API_Docs  
Documentation for interacting with the Snipt.org API.

Introduction

The Snipt.org API uses a REST service model. Currently the POST route is used for updating, creating, and removing data while GET is used to retrieve data. The API currently uses JSON-encoded results to maintain an object-oriented structure. The base URL for accessing the API is http://api.snipt.org.

Authorization

The Snipt.org API uses Twitter to perform authorization using a twitter username/password. You must have a twitter account to use the Snipt.org API.

In order to better protect service calls, you must first obtain a token from the API to communicate with it. This token is good for up to 8 hrs after your last call, after which point you will receive an error and need to re-authorize. CRUD actions can only be performed on Snipt(s) which you have permission to edit, aka: those in your snipt box. If you need to edit other snipts, you will need to obtain a new token using the twitter user/pass of the owner of that snipt.

Wrapping Results

All service calls take an optional "&useWrapper" param which, when set to true, will return the results using a resultWrapper object (see below). The default is false;

Basic Objects

Here are the basic objects returned by the Snipt API, and their properties.

Result Wrapper Object

Error Object

Snipt Object

Theme Object

Service Endpoints (functions)

Here is a listing of all the currently available service functions, this will be updated as new ones are added. All endpoints operate off of the base 'http://snipt.org/api/ENDPOINT/?VARS'. Where ENDPOINT is the name of the function and VARS is a query string containing the parameters for that function (GET only).

auth/

getSnipt/

getLanguages/

getThemes/

getSniptBox/

makeSnipt/

editSnipt/

deleteSnipt/

Error Codes

Here are the different error codes and corresponding messages returned by the Snipt API.

100

Theme does not exist.

101

Snipt privacy setting mismatch.

102

Snipt show line number setting mismatch.

103

Snipt language not found.

104

Elements missing.

105

Error creating snipt via API.

106

Error editing snipt via API.

107

Snipt box empty.

108

Theme does not exist.

109

Error deleting snipt via API.

401

API Authorization failed (is twitter down?).

404

API endpoint not found.

300

API token not found.

301

APU token EXPIRED.

Hosted by Google Code