Got the following error when using Ruby irb to test simple twitter status update ...
#<Net::HTTPForbidden:0x2ca15dc>
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<request>/statuses/update.xml</request>
<error>Client must provide a 'status' parameter with a value.</error>
</hash>
Code used was:
twitHeaders = {
"Content-Type"=>"text/html",
"Authorization" => "Basic " + Base64::encode64("account:password")
# where account is twitter account and password is twitter account password
}
def postTwitter statusMsg, headers
#url = URI.parse( "http://twitter.com/statuses/update.xml" )
url = URI.parse( "http://twitter.com/statuses/update.json" )
http = Net::HTTP.new(url.host, url.port)
resp, data = http.post(url.path, statusMsg , headers)
return resp, data
end
puts postTwitter( "status=hohoho", twitHeaders )
both .json and .xml effectively produce same result