TwitrPix API Documentation

TwitrPix provides a set of API tools to allow developers to integrate TwitrPix into their applications. These APIs may change and new functionality added in the future.

If you have special needs or would like to be notified when our API's are updated, please drop us a note at hi@twitrpix.com.


Requests

All requests must post data as multipart/form-data unless sending media as base64 encoded.


Responses

- UTF-8 encoded
- Successes have a stat of "ok"
- Errors have a stat of "fail"

Info TwitrPix API version 0.4 (Updated: 3/14/2010 - To be deprecated: 8/16/2010)

METHOD: uploadAndPost

http://api.twitrpix.com/uploadAndPost
Use this method to upload an image to Twitrpix and send a status update to Twitter with the media link.

Post data (must be formatted as multipart/form-data):

  • base64 (optional) - True or false (default)
  • media (required) - Binary image data. If base64, assumption is media contains base64 image data
  • username (required) - Twitter username
  • password (required) - Twitter password
  • message (optional) - Status update to post to Twitter.
  • tags (optional) - User-supplied tags
  • latitude (optional) - Latitude; used to geocode photos
  • longitude (optional) - Longitude; used to geocode photos
  • api_key (optional; required starting 6/31/10; Email us at hi@twitrpix.com to obtain one) - API Key


Sample success response:
			<?xml version="1.0" encoding="UTF-8"?>
			<rsp status="ok">
			<statusid>1111</statusid>
			<userid>11111</userid>
			<mediaid>abc123</mediaid>
			<mediaurl>http://twitrpix.com/abc123</mediaurl>
			</rsp>

Sample error response:
			<?xml version="1.0" encoding="UTF-8"?>
			<rsp stat="fail">
			<err code="1001" msg="Invalid Twitter username or password" />
			</rsp>

Error codes:
			1000 - Unknown error
			1001 - Invalid Twitter username or password
			1002 - Image not attached
			1003 - Image not supported
			1004 - Image exceeds maximum size
		

METHOD: upload

http://api.twitrpix.com/upload
Use this method to upload an image to Twitrpix only.

Post data (must be formatted as multipart/form-data):

  • media (required) - Binary image data
  • username (required) - Twitter username
  • password (required) - Twitter password
  • message (optional) - Status update
  • tags (optional) - User-supplied tags
  • latitude (optional) - Latitude; used to geocode photos
  • longitude (optional) - Longitude; used to geocode photos
  • api_key (optional; required starting 6/31/10; Email us at hi@twitrpix.com to obtain one) - API Key


Sample success response:
			<?xml version="1.0" encoding="UTF-8"?>
			<rsp status="ok">
			<statusid></statusid>
			<userid>11111</userid>
			<mediaid>abc123</mediaid>
			<mediaurl>http://twitrpix.com/abc123</mediaurl>
			</rsp>

Sample error response:
			<?xml version="1.0" encoding="UTF-8"?>
			<rsp stat="fail">
			<err code="1001" msg="Invalid Twitter username or password" />
			</rsp>

Error codes:
			1000 - Unknown error
			1001 - Invalid Twitter username or password
			1002 - Image not attached
			1003 - Image not supported
			1004 - Image exceeds maximum size
		

METHOD: Fullsize & Thumbnail Images

http://img.twitrpix.com/<size>/<media id>
Use this method to show TwitrPix images within your app. By parsing a TwitrPix URL within a status update, you can extract the media id and prepend the media URL to retrieve the image.

Sizes:
thumb - thumbnail
full - fullsize image

ie. http://twitrpix.com/6o - the media id

Obtain the thumbnail by using: http://img.twitrpix.com/thumb/6o
The full size image can be retrieved by: http://img.twitrpix.com/full/6o

Note: Thumbnails and fullsize images should link back to the photo detail page on TwitrPix or a link to the photo detail page provided to your end user.


METHOD: ping

http://api.twitrpix.com/ping
Use this method to test if the API system is up or in maintenance mode. No request parameters.

Sample success response:
			<?xml version="1.0" encoding="UTF-8"?>
			<rsp status="ok">
			<message>pong</message>
			</rsp>

Sample error response:
			<?xml version="1.0" encoding="UTF-8"?>
			<rsp status="ok">
			<message>maintenance</message>
			</rsp>