我的代碼如下BOX API:如何使用https://api.box.com/2.0/files/{fileId}/content下載
WebResource webResource1 = cl.resource("https://api.box.com/2.0/files/{fileId}/content");
ClientResponse res1 = webResource1.header("Authorization", "Bearer"+p1.getAccess_token()).get(ClientResponse.class);
String jsonStr1 = res1.getEntity(String.class);
我的回答是給獲得位置屬性響應如下所示 -
{Object-Id=[file_20317568941], Cache-control=[private], Date=[Wed, 24 Sep 2014 12:11:43 GMT], Content-Length=[27], X-Robots-Tag=[noindex, nofollow], Content-Disposition=[attachment;filename="upload.txt";filename*=UTF-8''upload.txt], Accept-Ranges=[bytes, bytes], Connection=[keep-alive], Content-Type=[text/plain; charset=UTF-8], Server=[nginx], X-Content-Type-Options=[nosniff]}
我得到狀態代碼200, OK
;但要獲得location
屬性,我需要具有狀態代碼302
以及位置url(https://dl.boxcloud.com/*
)。
在響應中沒有得到location: https://dl.boxcloud.com/*
屬性,我該如何從box api下載文件?
我找不到任何解決方案解決我的問題。任何人都面臨問題,並能夠解決它。請給我建議。提前致謝。 – 2014-10-09 04:48:01
你得到的東西看起來像實際響應的標題。我會建議你檢查你的代碼的語法 - 看看[這個例子](http://stackoverflow.com/questions/18342456/how-to-add-headers-on-restful-call-using-jersey-client -API#18359483)。 – chrisben 2014-10-16 20:53:29