I'm trying to do a simple query on my mongoDB database using the mlab data API. Making a GET request using the browser works fine, but when I try to make the same request using Ion, it keeps returning the message: "Please provide a valid API key."
So here I am trying to find a document with the fields username=user, and password=password:
Ion.with(this)
.load("https://api.mlab.com/api/1/databases/dbtest9238/collections/users?q={\"username\": \"user\", \"password\": \"password\"}&apiKey=" + apiKey)
.asJsonObject().setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
// do stuff with the result or error
}
});
I'm able to make POST requests with no problems, so I'm not sure what I'm doing wrong here.