This API is provided for compatibility reasons. While not required, please use the latest version of this method from our newest API for the best support including OAuth Echo authentication.
Description
This API endpoint is used for both photos and videos. If you are developing an app that already has TwitPic image upload support, nothing with the API endpoint has changed for video.
This method will return a 401 Unauthorized if the user could not be verified with Twitter. It will return a 400 Bad Request if one of the required parameters is missing.
Please note that any message posted as a photo caption will be publicly visible.
URL
http://api.twitpic.com/1/upload.format
Available Formats
xml, json
HTTP Method
POST
Requires Authentication
True
Parameters
- key (Required): Your API Key.
- consumer_token (Required): Your Twitter Consumer Token.
- consumer_secret (Required): Your Twitter Consumer Secret.
- oauth_token (Required): The Twitter OAuth Token for the user.
- oauth_secret (Required): The Twitter OAuth Secret for the user.
- message (Required): The tweet that belongs to the image. Can be empty string.
- media (Required): The file upload data.
Responses
If you receive a HTTP 200 OK header, you can assume the image was successfully uploaded.
Sample XML Response
<?xml version="1.0" encoding="UTF-8"?> <image> <id>1lacuz</id> <text>test</text> <url>http://twitpic.com/1lacuz</url> <width>220</width> <height>84</height> <size>8722</size> <type>png</type> <timestamp>Wed, 05 May 2010 16:11:15 +0000</timestamp> <user> <id>12345</id> <screen_name>twitpicuser</screen_name> </user> </image>
Sample JSON Response
{
"id" : "1lad07",
"text" : "test",
"url" : "http:\/\/twitpic.com\/1lacuz",
"width" : 220,
"height" : 84,
"size" : 8722,
"type" : "png",
"timestamp" : "Wed, 05 May 2010 16:11:48 +0000",
"user" : {
"id" : 12345,
"screen_name" : "twitpicuser"
}
}
Example CURL Command
curl -v -F "consumer_token=GDdmIQH6jhtmLUypg82g" -F "consumer_secret=yOahq5m0YjDDjfjxHaXEsW9D+X0=" -F "oauth_token=819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" -F "oauth_secret=yOahq5m0YjDDjfjxHaXEsW9D+X0=" -F "message=foo+bar" -F "key=098f6bcd4621d373cade4e832627b4f6" -F "media=@/path/to/image" http://api.twitpic.com/1/upload.json
