How to make calls to Twitter API using Postman client

TwitterPostman

Twitter Problem Overview


I have followed the steps required to create a new application and getting consumer key, secret pairs and also the token access details. Now I would like to make calls to Twitter Rest API, using chrome Postman client.

How should I pass the customer key, secret, token etc details to the request? I have tried to pass them as headers and also tried to pass them by selecting OAuth1.0 option in postman client but I am getting errors:

{
  "errors": [
    {
      "code": 32,
      "message": "Could not authenticate you."
    }
  ]
}

Twitter Solutions


Solution 1 - Twitter

I know this is old, but in case anyone is still facing this issue, the following steps worked for me:

  1. In Authorization tab, select OAuth 1.0
  2. Enter your consumer key, consumer secret, access token and access token secret
  3. Enable “Add params to header” and “Auto add parameters”
  4. Send the request

enter image description here

I hope that helps.

Solution 2 - Twitter

Juliana Chahoud's answer updated for 2018:

The add authorization data has been moved to the left column and requires you to select the drop down menu to change it to "Request Headers".

Postman 2018

Solution 3 - Twitter

Postman creates 6 character nonce, Twitter needs 32-character Nonce. So you can use any random value, I used ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 (length=32)

Solution 4 - Twitter

You must not pick Add params to header (pick will failed) You don't need to care about Nonce

enter image description here

Solution 5 - Twitter

Add authorization data to "Request Headers"

Example Twitter API: https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=snap

enter image description here

This will generate the Authorization header. Make sure this has been generated.

enter image description here

Result

[
    {
        "created_at": "Wed Mar 01 19:37:16 +0000 2017",
        "id": 837023955454201857,
        "id_str": "837023955454201857",
        "text": "RT @yoda: other things @snap has potentially worked on:\n\ntinker toys\nbaseball cards\nonesies\ntaco tosser\nshrunken christmas tree\nwalkie talk…",
        "truncated": false,
        "entities": {
            "hashtags": [],
            "symbols": [],
            "user_mentions": [
                {
                    "screen_name": "yoda",
                    "name": "drew olanoff",
...

Solution 6 - Twitter

For me, Postman created 11 character Nonce. I got the correct Twitter API response with the 11 character Nonce.

Solution 7 - Twitter

If anyone reaches this in 2017, my problem was the nonce too but the one with length 32 didn't work for me. I checked the tutorial and used the one posted there and it started working. Make sure you choose postman to add the authorization data to the headers and not the body.

This is my working nonce: kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg

Solution 8 - Twitter

After following the accepted answer, make sure there are no empty spaces at the end of the token/secret key. Otherwise, it will throw the same error Could not authenticate you.enter image description here

Solution 9 - Twitter

Apart from the authentication settings that are taken from twitter developer console, when searching q=target_user_id it worked as opposed from q=@target_user_id, where I got the error 32, could not authenticate you.

So, after numerous attempts, what made a difference was just removing the "@" symbol from the q parameter value.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionlearnerView Question on Stackoverflow
Solution 1 - TwitterJuliana ChahoudView Answer on Stackoverflow
Solution 2 - TwitterNathaniel RuizView Answer on Stackoverflow
Solution 3 - TwitterPratik PatilView Answer on Stackoverflow
Solution 4 - TwitterHaha TTproView Answer on Stackoverflow
Solution 5 - TwittermonView Answer on Stackoverflow
Solution 6 - TwitterSakhileti Satya KishoreView Answer on Stackoverflow
Solution 7 - Twittersebastianf182View Answer on Stackoverflow
Solution 8 - TwitterSaurabh PadwekarView Answer on Stackoverflow
Solution 9 - TwittercodeSwimView Answer on Stackoverflow