Just checked your Base String in my OAuth Base String Validator
(<http://quonos.nl/oauthTester/>), you apparently use too much URL
encoding on the status= part of the Base String. If I replace the %255F
with %5F, it doesn't give an error. ;-) (Don't ask me why. It just does)

Tom


On 9/18/10 2:28 AM, Elsa wrote:
> I got a question about sending "_" to twitter. It is working fine if I
> post it from twitter site but when I use statuses/update to post a
> status with "_", twitter is returning a failure. Posting other
> characters (e.g. "^" shown below) are fine using exactly the same
> code. I've attached the success and failure cases with the base
> strings used below. Please advice. Thanks!
> 
> Case1
> =====
> Status String: ^^^^^
> Base String: POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses
> %2Fupdate.xml&oauth_consumer_key%3Dxxxxxxxxxx%26oauth_nonce%3D#######
> %26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp
> %3D1284670556%26oauth_token%3Dyyyyyyyyyy%26oauth_version%3D1.0%26status
> %3D%255E%255E%255E%255E%255E
> Rseult: Success
> 
> http: -> Send header [requestId=15] (438 bytes): POST /1/statuses/
> update.xml HTTP/1.1
> Host: api.twitter.com
> Accept: */*
> Authorization: OAuth oauth_nonce="#######
> %",oauth_signature_method="HMAC-
> SHA1",oauth_timestamp="1284670556",oauth_consumer_key="xxxxxxxxxx",oauth_token="yyyyyyyyyy",oauth_signature="zzzzzzzzzz",oauth_version="1.0"
> Content-Length: 22
> Content-Type: application/x-www-form-urlencoded
> 
> Send data: status=%5E%5E%5E%5E%5E
> 
> HTTP/1.1 200 OK
> Date: Thu, 16 Sep 2010 20:55:57 GMT
> Server: hi
> Status: 200 OK
> X-Transaction: ######
> ETag: "######"
> Last-Modified: Thu, 16 Sep 2010 20:55:57 GMT
> X-Runtime: 0.12452
> Content-Type: application/xml; charset=utf-8
> Content-Length: 2214
> Pragma: no-cache
> X-Revision: DEV
> Expires: Tue, 31 Mar 1981 05:00:00 GMT
> Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-
> check=0
> Set-Cookie: k=xxx.xxx.xxx.xx.xxxxxxxxxx; path=/; expires=Thu, 23-
> Sep-10 20:55:57 GMT; domain=.twitter.com
> Set-Cookie: guest_id=######; path=/; expires=Sat, 16 Oct 2010 20:55:57
> GMT
> Set-Cookie: lang=en; path=/
> Set-Cookie: _twitter_sess=##########; domain=.twitter.com; path=/
> Vary: Accept-Encoding
> Connection: close
> <?xml version="1.0" encoding="UTF-8"?>
> <status>
> <created_at>Thu Sep 16 20:55:57 +0000 2010</created_at>
> <id>##########</id>
> <text>^^^^^</text>
> .....
> 
> Case2
> =====
> Status String: _____
> POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses
> %2Fupdate.xml&oauth_consumer_key%3Dxxxxxxxxxx%26oauth_nonce%3D#######
> %26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp
> %3D1284670570%26oauth_token%3Dyyyyyyyyyy%26oauth_version%3D1.0%26status
> %3D%255F%255F%255F%255F%255F
> Result: Fail
> 
> http: -> Send header [requestId=16] (441 bytes): POST /1/statuses/
> update.xml HTTP/1.1
> Host: api.twitter.com
> Accept: */*
> Authorization: OAuth oauth_nonce="#######
> %",oauth_signature_method="HMAC-
> SHA1",oauth_timestamp="1284670570",oauth_consumer_key="xxxxxxxxxx",oauth_token="yyyyyyyyyy",oauth_signature="zzzzzzzzzz",oauth_version="1.0"
> Content-Length: 22
> Content-Type: application/x-www-form-urlencoded
> 
> Send data: status=%5F%5F%5F%5F%5F
> 
> HTTP/1.1 401 Unauthorized
> Date: Thu, 16 Sep 2010 20:56:11 GMT
> Server: hi
> Status: 401 Unauthorized
> WWW-Authenticate: Basic realm="Twitter API"
> Content-Type: application/xml; charset=utf-8
> Content-Length: 135
> Cache-Control: no-cache, max-age=1800
> Set-Cookie: k=xxx.xxx.xxx.xx.xxxxxxxxxx; path=/; expires=Thu, 23-
> Sep-10 20:56:11 GMT; domain=.twitter.com
> Set-Cookie: guest_id=######; path=/; expires=Sat, 16 Oct 2010 20:56:11
> GMT
> Set-Cookie: _twitter_sess=##########; domain=.twitter.com; path=/
> Expires: Thu, 16 Sep 2010 21:26:11 GMT
> Vary: Accept-Encoding
> Connection: close
> <?xml version="1.0" encoding="UTF-8"?>
> <hash>
> <request>/1/statuses/update.xml</request>
> <error>Incorrect signature</error>
> </hash>
> 

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to