Hi Andy,
Hope you are doing good.
I am sorry till now the User search stuff was not fixed by me…
Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res;
String sq = ‘%23twitter’;
sq = sq.replace(’*’,’%2A’).replace(’+’,’%20’);
String endPointValue = ‘https://api.twitter.com/1.1/users/search.json?q=’+sq+’&page=1&count=3’;
req.setEndpoint(endPointValue);
req.setBody(‘Content-Type=’ +EncodingUtil.urlEncode(‘application/x-www-form-urlencoded’,‘UTF-8’).replace(’*’,’%2A’).replace(’+’,’%20’).replace(’!’,’%21’).replace(’(’,’%28’).replace(’)’,’%29’)+
‘&oauth_consumer_key=’ + EncodingUtil.urlEncode(‘Consumer Key’, ‘UTF-8’).replace(’*’,’%2A’).replace(’+’,’%20’).replace(’!’,’%21’).replace(’(’,’%28’).replace(’)’,’%29’)+
‘&oauth_nonce=’ + EncodingUtil.urlEncode(‘c1ff53033e97cad9034ed1faeb5f80e4’, ‘UTF-8’).replace(’*’,’%2A’).replace(’+’,’%20’).replace(’!’,’%21’).replace(’(’,’%28’).replace(’)’,’%29’)+
‘&oauth_signature=’ + EncodingUtil.urlEncode(‘o6a4w8VhekhSPOdKREWoCqmPzks%3D’, ‘UTF-8’).replace(’*’,’%2A’).replace(’+’,’%20’).replace(’!’,’%21’).replace(’(’,’%28’).replace(’)’,’%29’)+
‘&oauth_signature_method=’ + EncodingUtil.urlEncode(‘HMAC-SHA1’, ‘UTF-8’).replace(’*’,’%2A’).replace(’+’,’%20’).replace(’!’,’%21’).replace(’(’,’%28’).replace(’)’,’%29’)+
‘&oauth_timestamp=’+ EncodingUtil.urlEncode(‘1432381966’, ‘UTF-8’).replace(’*’,’%2A’).replace(’+’,’%20’)+
‘&oauth_token=’+EncodingUtil.urlEncode(‘Oath_Token’, ‘UTF-8’).replace(’*’,’%2A’).replace(’+’,’%20’).replace(’!’,’%21’).replace(’(’,’%28’).replace(’)’,’%29’)
+
’&oauth_version=’+EncodingUtil.urlEncode(‘1.0’, ‘UTF-8’));
req.setMethod(‘GET’);
res = h.send(req);
system.debug(’------------’+res.getbody());
But I am getting the Authentication issue -
{“errors”:[{“code”:32,“message”:“Could not authenticate you.”}]}
Can you please help me how to get rid off the issue… Please help…