I'm trying to get result from this query.
.1/search/tweets.json?q=?&geocode=39.893280,32.779655,5km&count=100
I'm getting code:32 Could not authenticate you
error. I'm using parse cloud code.
Parse.Cloud.httpRequest({
method: 'GET',
url: urlLink,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization" : 'OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"'
},
body: {
},
success: function(httpResponse) {
// console.log(httpResponse.text);
response.success(httpResponse.text);
},
error: function(httpResponse) {
response.error('Request failed with response ' + httpResponse.status + ' , ' + JSON.stringify(httpResponse));
}
});
I generated everything from here. So the keys and the signature is correct. Probably the urlLink I'm giving is in wrong format but I checked it a few times. What is wrong here?
Here is the curl code which works correct. Newlines are just for better readability.
curl --get '.1/search/tweets.json'
--data 'count=100&geocode=39.893280%2C32.779655%2C5km&q=%3F'
--header 'Authorization: OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"' --verbose
I'm trying to get result from this query.
https://api.twitter./1.1/search/tweets.json?q=?&geocode=39.893280,32.779655,5km&count=100
I'm getting code:32 Could not authenticate you
error. I'm using parse cloud code.
Parse.Cloud.httpRequest({
method: 'GET',
url: urlLink,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization" : 'OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"'
},
body: {
},
success: function(httpResponse) {
// console.log(httpResponse.text);
response.success(httpResponse.text);
},
error: function(httpResponse) {
response.error('Request failed with response ' + httpResponse.status + ' , ' + JSON.stringify(httpResponse));
}
});
I generated everything from here. So the keys and the signature is correct. Probably the urlLink I'm giving is in wrong format but I checked it a few times. What is wrong here?
Here is the curl code which works correct. Newlines are just for better readability.
curl --get 'https://api.twitter./1.1/search/tweets.json'
--data 'count=100&geocode=39.893280%2C32.779655%2C5km&q=%3F'
--header 'Authorization: OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"' --verbose
Share
Improve this question
edited Mar 31, 2015 at 15:39
Thellimist
asked Mar 30, 2015 at 21:36
ThellimistThellimist
4,0277 gold badges34 silver badges51 bronze badges
7
-
What's with
q=?
? Shouldn't that be your search term? – Phil Commented Mar 31, 2015 at 0:39 - search everything in the specified location. like SELECT * – Thellimist Commented Mar 31, 2015 at 8:34
- Then it should be url encoded like it is in your curl request – Phil Commented Mar 31, 2015 at 20:09
- I tried that but maybe I did something wrong can you provide an example? – Thellimist Commented Mar 31, 2015 at 20:17
- 1 It's more apt to close as a "typo". FYI, you should pay close attention to the documentation - "q: A UTF-8, URL-encoded search query of 500 characters maximum, including operators" – Phil Commented Mar 31, 2015 at 23:38
1 Answer
Reset to default 6The problem was instead of ?
I should have wrote %3F
Here is the lastest version of the query
https://api.twitter./1.1/search/tweets.json?q=%3F&geocode=39.893280,32.779655,5km&count=100
Doc: https://dev.twitter./rest/reference/get/search/tweets
q: A UTF-8, URL-encoded search query of 500 characters maximum, including operators