1
我在我的應用程序中使用CamFind API進行圖像識別。我正在關注CamFind Tutorial ,但堅持在發佈數據後如何從API獲取響應?你如何得到我的問題。如何獲得CamFind API的結果?
我在我的應用程序中使用CamFind API進行圖像識別。我正在關注CamFind Tutorial ,但堅持在發佈數據後如何從API獲取響應?你如何得到我的問題。如何獲得CamFind API的結果?
試試這個代碼
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();
}
現在身體字符串包含在它裏面有一個令牌變量JSON響應字符串
並得到認可其名一樣了,但除去fields
並添加Token
網址 後值,使之看起來就像這樣: https://camfind.p.mashape.com/image_requests/(Token Vlaue)
現在身體字符串將包含name
值