Getting Trend Topics but how?


#1

Hi all,

I am trying to GET trends/place but not successful. I made some research at this discussion boards and other websites but can not still solve my problem. The biggest problem is that twitter developer page does not gives sufficient information about a topic and the suggestions does not work. Let me explain more… I read the explanation of the GET trend/places and got the idea.

Then I select an application of mine and click on “Generate OAuth Signature” button.
Then it ask me what will I do with it (GET,POST etc) I select GET and asks for a “Request Query” which is “id=23424969” which is WOEID of Turkey where I want to get the trend topics of. (Even not works with global id=1). Just to remember, I will use this at a C# project. Then I click “See OAuth signature for this request” button.

Then it gives me 3 types of results. Signature base string, Authentication header and cURL command. I prefer signature base string so I can download the response. Here is the result (tokens are marked with x, y, z)

GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Ftrends%2Fplace.json&id%3D23424969%26oauth_consumer_key%3Dxxxxx%26oauth_nonce%3Dyyyyy%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1385468149%26oauth_token%3Dzzzz%26oauth_version%3D1.0

I tried many things, like;

  1. posting this string to browser (with GET and without GET at the beginning), not worked
  2. posting this and trying to read and download the page with C# code (which can read and download an ordinary page) (with GET and without GET at the beginning), not worked
  3. changing the above string to below format

GET&https://api.twitter.com/1.1/trends/place.json?id=23424969&oauth_consumer_key=xxxxx&oauth_nonce=yyyyy&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1385468149&oauth_token=zzzz&oauth_version=1.0

and trying with browser (with GET and without GET at the beginning), not worked.

  1. making the change at the step 3 and trying with C# code (with GET and without GET at the beginning), not worked.

I am always getting this reply;

{“errors”:[{“message”:“Bad Authentication data”,“code”:215}]}

So this string is generated by Twitter API itself but getting Bad Authentication error. As far as I see it has the credentials in the string.

Can you tell me what am I doing wrong? What should I do?

Thanks in advance for the answers and guidelines.


#2

The OAuth tool is there to help you learn OAuth while building the code out in your application… it can provide some rudimentary ways to help you explore that API a little, but really it can’t be used to accomplish much more than help you code an app.

The signature base string is part of OAuth 1.0A and it isn’t a URL that can be navigated to – it’s a string that gets “signed” with a secret key. This signature is then required when formulating requests to Twitter as a kind of proof your application and user’s identity.

It’s difficult to work with the API in a web browser without some kind of plugin that is capable of performing OAuth.

You might want to look into using the API on the command line instead. Twurl is a great tool for that – https://github.com/marcel/twurl

Also, take a look at https://dev.twitter.com/console


#3

Dear Taylar,

Thank you for the great reply. But I don’t need to work with the API on neither command line nor a website or browser. So twurl is not the thing that I request. I need this authentication made at a Forms application. So that the application can get authorized with twitter and get the trends for a place.

I am also using stream api for many months with token authentication but it is made with help of another API but it does not fulfill this mission, it is accomplishing it’s own mission perfectly.

So if that OAuth tool only helps us explore the API a little bit, with no observable result, how should we get benefit of that tool? It gives me some info (string based etc) but they are not working, I mean not resulting. So it becomes useless if it does not help me understand and implement the solution.

The console is giving me answers of my query, trends for a place. But it also does not give me the authenticating string or code.

Still I am looking for an exact solution for a C# WFA solution. I made the research but many people facing with this 215 error. I think I need the query sting that can be either written on the browser or can be downloaded with code. Or any guidance will be appreciated.

Thank you