I queried the Bing web search api with the "food" word.
This is the code:
Ion.with(this)
.load("https://api.cognitive.microsoft.com/bing/v5.0/search")
.setHeader("Ocp-Apim-Subscription-Key", "xxxxxxxxxxxxxxxxxxxx")
.setBodyParameter("q", "food")
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
System.out.println("result = " + result);
}
});
I made this request with Ion library Android Ion library
I got this response:
{"statusCode":404,"message":"Resource not found"}
I followed Bing documentations carfully.
I made a call via "Postman" client on Desktop Chrome browser and I got good fully response.
What is missing with the Android request?
Update
I did the request with other AsyncHttp library called Android Asynchronous Http Client and it worked perfect!
I wonder what is wrong with Ion library..