尝试使用新的 API 下载文件。但出现错误(NotFound)
使用旧 API,我下载得很好:
wcGetFile.DownloadStringAsync(new Uri("https://www.box.net/api/1.0/download/" + auth_token + "/2111821875"));
对于新的 API,这是我的代码:
wcGetFile.Headers[HttpRequestHeader.Authorization] = "BoxAuth api_key=" + api_key + "&auth_token=" + auth_token;
wcGetFile.DownloadStringAsync(new Uri("https://api.box.com/2.0/files/2111821875/data"));
该文件确实存在,因为如果我从通话结束时删除“数据”,我会得到没有错误的文件信息。
wcGetFile.Headers[HttpRequestHeader.Authorization] = "BoxAuth api_key=" + api_key + "&auth_token=" + auth_token;
wcGetFile.DownloadStringAsync(new Uri("https://api.box.com/2.0/files/2111821875"));
根据文档,信息和实际文件之间的唯一区别是网址的“数据”部分。但这似乎对我不起作用。
最佳答案
我们这边似乎遇到了一个小错误,导致下载失败。如果您使用“https://www.box.com/”而不是“https://api.box.com/”,则下载应该可以正常工作。不过,我们现在正在努力修复该错误!
关于.net - Box API 2.0 下载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10393139/