K. Siva Prasad Reddy
K. Siva Prasad Reddy

Reputation: 12385

What parameters and headers we need to pass to connect to Twitter using REST API?

I am trying to connect to Twitter through REST API using Java. I am passing the following Query Parameters using POST to

https://api.twitter.com/1/statuses/update.json.

include_entities=true
oauth_consumer_key=**********
oauth_consumer_secret=************
oauth_nonce=***********
oauth_signature_method=HMAC-SHA1
oauth_timestamp=1340329822
oauth_token=***************
oauth_version=1.0
status=test msg

What is the actual process to connect to Twitter? First I need to get auth_token using authorize request and then issue update.json request?

What ever request I am issue I am getting

{"error":"Could not authenticate you.","request":"\/1\/statuses\/update.json"}

But I checked all my config params(keys/secrets) and they are correct. I tried connecting with the same parameters using Twitter4J and working fine.

When I tried to invoke from REST Client Tool (http://code.google.com/a/eclipselabs.org/p/restclient-tool/) with same params its failing.

Any help?

Upvotes: 0

Views: 658

Answers (1)

air-dex
air-dex

Reputation: 4180

You have to pass your oauth_* parameters in a header called "Authorization", not with the other POST parameters. It is explained in the Twitter API documentation here : https://dev.twitter.com/docs/auth/authorizing-request

Upvotes: 1

Related Questions