In my Android application, have integrated Twitter.
I have changed the user/show api version 1 to version 1.1. The new api is not working and it gives 400 - Bad request exception. I have spend a lot of time to resolve but unable to find out the solution.
version 1 api for user/show:
"https://api.twitter.com/1/users/show.json?user_id="+userID+"&include_entities=true"
version 1.1 api for user/show:
"https://api.twitter.com/1.1/users/show.json?user_id="+userID+"&include_entities=true"
I have tried without include_entities=true
and include_entities=false
.
Referred the twitter developer site: enter link description here
In my code I am using http GET method to get json response from the api.
code sample:
StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(params[0]);
try {
HttpResponse response = client.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode == 200) {
----------
} else {
Log.e("Server code ", statusCode + " * " + statusLine+" Failed to download");
}
Exception I get:
Server code(460): 400 * HTTP/1.1 400 Bad Request Failed to download
please help me to solve the problem.