What is the format for search operators / special characters


#1

Hi All,

I’m successfully connecting to the streaming API and using the filter parameter. I have tried to add the location parameter in and the Authorization fails.

I have added the location string into the OAuth base string and encoded it as the documentation requires. I have then included it on the end of the POST data eg https://blah/blah.json?track=Silverstone&locations=-2.10, 58.23, -2.78, 60.60

I don’t understand why the authorization fails. I suspect it is something to do with the fact I encoding the geocodes in the authorization string. Is any able to clarify as the documentation is unclear (to me at least.)

Thank you.
Tim


#2

OK I tracked this back to having ANY comma in the data string causes the authorization to fail… I’m still looking into it.

For example if I send https://stream.twitter.com/1.1/statuses/filter.json?stall_warnings=true&track=stafford%2C%20council - 401 unauthorized received

if I send send https://stream.twitter.com/1.1/statuses/filter.json?stall_warnings=true&track=stafford council - Connected and start receiving stream…

Any ideas - I’m seriously stuck… (as you can see I’m encoding both the signature base string values and the values on the data string on the URI).

Thanks


#3

Also, the OAuth tool values fail too. I checked my code generated values (several times!) against the OAauth tool generated base string and they are exactly the same, The OAuth header’s are same with exception of the time and therefore the signature… But the OAuth tool values get the same response - 401 Unauthorised (when manually submitted using fiddler2)…

here’s my values --> this time using track parameters of ‘silverstone + F1’ (minus the quotes obviously)

OAuth Signature Base String is:-
POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&oauth_consumer_key%3DkhjXI7dM6EqoV0sJeZk4A%26oauth_nonce%3D
66610345%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1372414782%26oauth_token%3D120250594-ndYclCBaaM61FWc6F1kdyXaxJdti3FNvSyJyEJ16%26oauth_version%
3D1.0%26stall_warnings%3Dtrue%26track%3Dsilverstone%2520%2B%2520F1

URI params
stall_warnings=true&track=silverstone%20%2B%20F1


#4

in answer to my own questions! don’t code when tried :slight_smile:

in c#, when encoding your params always use System.Uri.EscapeDataString and not System.Uri.EscapeUriString…


#5

Thanks for following up with the solution. For the OAuth tool, you shouldn’t preemptively escape the fields you’re sending (although this is a little unintuitive). Using the string “stall_warnings=true&track=silverstone + F1” worked for me.