I am new to NoSQL database and cloud. I am trying to develop a simple application in android using Clusterpoint (DBAAS). I tried and searched so many possibilities, but it is not quite working.
(new AsyncTask<Void, Void, String>() {
@Override
protected String doInBackground(Void... params) {
String result = "";
try {
String requestString = "https://username:password@api-eu" +
".clusterpoint.com/908/users/";
HttpClient httpClient = new DefaultHttpClient();
HttpResponse httpResponse = null;
HttpPost httpPost = new HttpPost(requestString);
HttpResponse response = httpClient.execute(httpPost);
HttpEntity httpEntity = response.getEntity();
result = EntityUtils.toString(httpEntity);
} catch (IOException e) {
result = "Error";
e.printStackTrace();
} finally {
Log.v("ClusterResponse", result);
return result;
}
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Log.v("ClusterResponse", s);
}
}).execute();
In my code i replaced username and password with original values.
I got the connection. I am posting my code so the next person can get it right in a much faster way
My mistakes - Needed GET instead of POST - Authorization should be of base64 with NOWRAP , so it won't add "CR" line at the end.