try this code
try {
HttpResponse<JsonNode> request = Unirest
.post("https://camfind.p.mashape.com/image_requests")
.header("X-Mashape-Authorization",
"A0MYOpCsdfasdgadfadafgdj7vsdfe")
.field("image_request[locale]", "en_US")
.field("image_request[image]",
new File("your Image path")).asJson();
String body = request.getBody().toString();
Log.v("body", body);
} catch (UnirestException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
now the body string contain the json response String with a Token variable inside it
and to get the recognition name do the same again, but remove the fields
and add the Token
value after the url
so it will look like this:
https://camfind.p.mashape.com/image_requests/(Token Vlaue)
now the body string will contain the name
value