There are something weird happened in update api.
http://twitter.com/statuses/update.format
will response with 302 if user-agent is not curl. For example
curl -v -u username -d status=test302
http://twitter.com/statuses/update.json
> POST /statuses/update.json HTTP/1.1
> Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> User-Agent: curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/
1.2.3.3 libidn/1.1
> Host:
twitter.com
> Accept: */*
> Content-Length: 14
> Content-Type: application/x-www-form-urlencoded
< HTTP/1.1 200 OK
< Date: Mon, 07 Apr 2008 06:42:47 GMT
< Server: hi
< Status: 200 OK
< P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
< X-Runtime: 0.02310
< ETag: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
< Cache-Control: private, max-age=0, must-revalidate, max-age=300
< Content-Type: application/json; charset=utf-8
< Content-Length: 464
< Set-Cookie:
_twitter_sess=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
domain=.
twitter.com; path=/
< Via: 1.1
twitter-web008.twitter.com
< Expires: Mon, 07 Apr 2008 06:47:47 GMT
< Connection: close
Anyway, it returns 302 if user-agent is midp.
> POST /statuses/update.json HTTP/1.1
> Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Host:
twitter.com
> Accept: */*
> Content-Length: 14
> Content-Type: application/x-www-form-urlencoded
< HTTP/1.1 302 Moved Temporarily
< Date: Mon, 07 Apr 2008 07:13:00 GMT
< Server: hi
< Status: 302 Found
< Last-Modified: Mon, 07 Apr 2008 07:13:00 GMT
< P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
< Location:
http://twitter.com/home
< X-Runtime: 0.01321
< Pragma: no-cache
< Cache-Control: no-cache, must-revalidate
< Content-Type: application/xhtml+xml; charaset=UTF8
< Content-Length: 89
< Expires: Sat, 26 Jul 1997 05:00:00 GMT
< Set-Cookie:
_twitter_sess=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
domain=.
twitter.com; path=/
< Via: 1.1
twitter-web046.twitter.com
< Vary: Accept-Encoding
< Connection: close
The api works correctly if follow the redirection to
http://twitter.com/home
but the problem is I have to read response about 4 KB HTML instead of
400 B JSON. I just don't want to waste 10 times bandwidth for nothing.
Note that J2ME applications are not allowed to change user-agent
unless they are signed.
Moreover, most J2ME clients now doesn't work correctly because of this
302 response.