I get an error message:
W/System.err(32720): java.lang.IllegalArgumentException: Illegal character in query at index 89: https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={%20mean0%22:%201}&apiKey=myApiKey String apiURI = "https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={%22mean0%22:%201}&apiKey=myApiKey";
- When I insert this URI into the browser, it works fine.
- When I insert into the browser, open it and then copy the URI into your code, this will not help.
- Index 89 - {- How is it an illegal character?
I tried to do this - replacing curly braces with% 7B: but this does not help
https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f=%7B"mean0":%201%7D&apiKey=myApiKey
Is anyone
EDIT:
String query = "https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={\""+arrayName+"\":%201}&apiKey=myApiKey"; try { query = URLEncoder.encode(query, "utf-8"); } catch (UnsupportedEncodingException e1) {
Does not help. Now I get:
05-23 22:13:21.855: E/SendMail(12428): Target host must not be null, or set in parameters. scheme=null, host=null, path=https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={"mean0":%201}&apiKey=myAPI
and if I change% 20 to a space in the request declaration, I get:
05-23 22:14:51.435: E/SendMail(13164): Target host must not be null, or set in parameters. scheme=null, host=null, path=https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={"mean0":+1}&apiKey=myAPI
Also, if I don't use the string arrayName in the middle and just use the string directly from the browser, the effect will be the same!
source share