You are here: Photobucket API Help > Getting Started > Response Formats

REST Response Formats

The Photobucket API uses Representational State Transfer (REST) for requests and responses, so that domain-specific data can be transferred over HTTP without an additional messaging layer such as SOAP or session tracking via HTTP cookies. For an explanation of REST conventions, see http://microformats.org/wiki/rest/urls.

The REST response format is a simple XML block that includes the action in a <method> tag: HTTP GET, POST, PUT, or DELETE. When using the REST request method, the response defaults to REST. The response format can be specified in the request. See Request Format for details.

The default response format is XML. All responses are wrapped in a "response envelope" that contains:

Exception messages are formatted the same way as success messages, with the exception of a 404 (wrong method) message. A 404 is always in plain text because Photobucket may be unable to construct a response properly.

In the case of an error response (or exception), a "code" and "message" are included which detail the exception case (see Error Codes). Most likely, there will not be any content. For example:

Sample Failed Method Call Response 

Overriding Response Method

In some cases, Consumers will want to receive a response in a format other than XML. Current valid response formats are:

To set the response format, use the format parameter in the request.

Format: XML (Default)

XML is the default format.

Notes:

Sample Request
Sample Successful Response

Format: json

JSON is the Javascript Object Notation format. The entire response is one object, with nested properties and objects.

Note: Some values will be one layer deep in an "_attribs" value. Compare this to an elements attributes in XML.

Sample Request
Sample Response

Format: jsonp

JSONP, which is json with a callback, is a protocol supported by YouTube, Google, Social Graph, Twitter and Digg. It provides a way to get to resources with Javascript outside the current domain. To use, set "format=jsonp", and specify a callback function name in the jsonp_callback parameter. The callback can be word characters and dot, supporting OO code. See Format: json (above) for other specifics.

Notes:

Code 

Sample Request
Sample Response

Format: phpserialize

The response is contained in a PHP array, containing values or other arrays.

Note: Some values will be one layer deep in an ‘_attribs’ value. Compare this to an elements attributes in XML

Sample Request
Sample Response

 

Published 2-September-09. See developer.photobucket.com for additional resources.