Ashish Mittal
Ashish Mittal

Reputation: 141

Doing a POST request to twitter

I'm having problem creating the POST request (to tweet) in twitter. I dont want to use any library. I have all the oauth required parameters but still unable to do a valid request when i'm doing

curl "https://api.twitter.com/1/statuses/update.json?oauth_signature=NCs%2B1unOYZQW%2BNCTmsRwmiqtrZQ%3D&oauth_version=1.0&oauth_nonce=-619997894&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=gGrr4khdilkzano8gYxK4Q&oauth_token=146439820-n07FzSB78bDWEUzPPP9WZnwdnwW917FyJi1gwKWM&oauth_timestamp=1341309839" -d 'status=hello'

then i'm getting "Could not authenticate you.","request":"/1/statuses/update.json"

I know that the OAuth parameters are right coz i'm able to do GET request like

https://api.twitter.com/1/statuses/public_timeline.json?oauth_signature=NCs%2B1unOYZQW%2BNCTmsRwmiqtrZQ%3D&oauth_version=1.0&oauth_nonce=-619997894&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=gGrr4khdilkzano8gYxK4Q&oauth_token=146439820-n07FzSB78bDWEUzPPP9WZnwdnwW917FyJi1gwKWM&oauth_timestamp=1341309839

and its working just fine. So please help me to resolve the issue.

Upvotes: 0

Views: 1438

Answers (1)

air-dex
air-dex

Reputation: 4180

Your second request works because it doesn't require authentication.

When you have to authenticate a request, you should do this with a HTTP header called Authorization as described here : https://dev.twitter.com/docs/auth/authorizing-request

Upvotes: 1

Related Questions