Zoopy REST API Documentation

This document specifies the Zoopy REST API, and outlines how to call each of the methods offered by the API. If you are unsure how RESTful APIs work, you can start by having a look at Wikipedia. The API sits on http://api.zoopy.com, and the URLs listed below are relative to that host. You can send all feedback and any queries to api@zoopy.com.

This document was last updated at Thu, 26 Mar 2009 12:46:28 +0200

API Standards

Calling API methods

Methods in this API should be called as regular HTTP requests. The HTTP request method needed in each instance is specified in this document, and as mentioned in the introduction all URLs below are relative to http://api.zoopy.com. The values in parentheses indicate a variable. Accepted values will depend on the circumstance, but in general the following holds:

VariableAccepted values
format'xml' or 'json'
idAny positive integer

Authentication

Each API request requires that your Zoopy username and password be sent. The API implements basic HTTP authentication. Failure to provide these credentials will result in a 401.

HTTP Response Codes

In line with the RESTful style, all methods in this API respond with meaningful HTTP codes. The response codes depend on the request, but the following response codes are returned by all methods:

CodeDescription
401Authorization required.

The API requires that your Zoopy username and password be supplied with each request. Basic HTTP authentication is used.
404Not found.

The requested method has not been implemented.
501Not implemented.

The requested format has not been implemented for this method.
The HTTP request method has not been implemented for this method.
500Internal server error.

There has been an error generating a response the request.

Response content

Each response will contain a flag to tell you whether or not the response is an error or the requested content. Below are what you can expect for errors/successes in both XML and JSON:

XMLJSON
Error
<result type="error">
	<title>Not found</title>
	<message>The requested media 
	item does not exist.</message>
	<httpCode>404</httpCode>
</result>
{
	"result":"error",
	"content":{
		"title":"Not found",
		"message":"The requested media item does not exist.",
		"httpCode":404
	}
}
Success
<result type="success">
	<media uri="http://api.zoopy.com/rest/media/1.xml">
		<type>photo</type>
		<title><![CDATA[MCQP Laser Show]]></title>
	</media>
</result>
{
	"result":"success",
	"content":{
		"media":{
			"uri":"http:\/\/api.zoopy.com\/rest\/media\/1.json",
			"type":"photo",
			"title":"MCQP Laser Show"
		}
	}
}

PHP Client

Download (version: 0.1, last updated: 25 March 2009)

User

GET /rest/user/(id).(format)

Returns details about the user with the given ID.

HTTP response codes:

CodeDescription
404No user with the specified ID exists
200Success

GET /rest/user/(id)/follows.(format)

Returns a paginated list of users that this user follows.

GET parameters:

RequirementNameDescriptionDefault
optionalpage1
optionalperPage10

HTTP response codes:

CodeDescription
404No user with the specified ID exists
200Success

GET /rest/user/(id)/followers.(format)

Returns a paginated list of users that follow this user.

GET parameters:

RequirementNameDescriptionDefault
optionalpage1
optionalperPage10

HTTP response codes:

CodeDescription
404No user with the specified ID exists
200Success

GET /rest/user/(id)/media.(format)

Returns a paginated list of this user's media items.

GET parameters:

RequirementNameDescriptionDefault
optionalpage1
optionalperPage10

HTTP response codes:

CodeDescription
404No user with the specified ID exists
200Success

Media

GET /rest/media/search.(format)

Searches media against supplied criteria and returns a paginated list of matching media.

GET parameters:

RequirementNameDescriptionDefault
requiredqueryThe search query to match against
optionalorderHow the results should be ordered, one of 'relevance', 'date' and 'views' 'relevance'
optionalpage1
optionalperPage10

HTTP response codes:

CodeDescription
400No search query specified or the ordering is invalid
200Success

GET /rest/media/(id).(format)

Returns details about the media item with given ID.

HTTP response codes:

CodeDescription
404No media item with the specified ID exists
401The media item is private and you are not the owner
200Success

POST /rest/media/upload.(format)

Submits a file to be uploaded. The POST should be sent as multipart/form-data, in a similar way to how yourbrowser would submit a form with a file input. The file's parameter is called 'file'.

POST parameters:

RequirementNameDescriptionDefault
requiredfileSee method description
requiredtitleTitle of the new media item, max. 255 characters
optionaltagsComma-separated list of tags, max. 255 characters
optionaldescriptionDescription for the new media item, max. 65535 characters
optionalprivacy'private' or 'public' 'public'
optionallicenseZoopy license ID, see http://api.zoopy.com/rest/licenses.format
optionalcomments'open', 'closed' or 'hidden' 'open'

HTTP response codes:

CodeDescription
406There is an error in the data submitted
201The upload has been accepted (photos only)
202The upload has been accepted for processing (videos and audio clips only)

Tag

GET /rest/tag/(id).(format)

Returns the name of the tag with the given ID and a paginated list of media that are tagged with it.

GET parameters:

RequirementNameDescriptionDefault
optionalpage1
optionalperPage10

HTTP response codes:

CodeDescription
404No tag with the specified ID exists
200Success