除了瑪麗亞的意見,我想從以下問題第一兩種解決方案:
How do I send a file in Android from a mobile device to server using http?
我建議要經過前2解決方案,因爲他們將最有可能工作。在RESPONSE
,一個Operation-Location
和OID
被接收時,可以使其中HTTP GET
呼叫:
https://westus.api.cognitive.microsoft.com/emotion/v1.0/operations/{oid}
文檔:https://westus.dev.cognitive.microsoft.com/docs/services/5639d931ca73072154c1ce89/operations/56f8d4471984551ec0a0984f
我用於GET請求的代碼:
URIBuilder statusBuilder = new URIBuilder("https://westus.api.cognitive.microsoft.com/emotion/v1.0/operations/{oid});
statusBuilder.setParameter("oid", {oid});
URI uriStatus = statusBuilder.build();
HttpGet statusRequest = new HttpGet(uriStatus);
statusRequest.setHeader("Ocp-Apim-Subscription-Key", {key});
HttpResponse statusResponse = httpclient.execute(statusRequest);
HttpEntity entity = statusResponse.getEntity();
Header[] statusHeaders = statusResponse.getAllHeaders();
for (Header header : statusHeaders) {
System.out.println("Key : " + header.getName()
+ " ,Value : " + header.getValue());
}