1

我正在尝试通过 Box API 创建一个文件夹。这是我的请求的样子:

-------------- REQUEST  --------------
POST https://api.box.com/2.0/folders/0
Accept-Encoding: gzip
Authorization: Bearer [hidden]
User-Agent: Google-HTTP-Java-Client/1.14.1-beta (gzip)
Content-Type: application/json; charset=UTF-8
Content-Length: 36

-------------- REQUEST BODY ----------
{"name":"test2","parent":{"id":"0"}}

-------------- RESPONSE --------------
HTTP/1.1 403 Forbidden
Date: Wed, 10 Apr 2013 21:15:53 GMT
Content-Length: 224
Content-Type: application/json
Connection: keep-alive
Server: nginx
Cache-Control: no-cache, no-store

-------------- RESPONSE BODY----------
{"type":"error","status":403,"code":"access_denied_insufficient_permissions","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Access denied - insufficient permission","request_id":"19725779175165d68967049"}

有人可以解释我的请求有什么问题吗?在对具有相同 Bearer 标头的其他请求的响应中,我收到了正确的结果:

-------------- REQUEST  --------------
GET https://api.box.com/2.0/folders/0
Accept-Encoding: gzip
Authorization: Bearer [hidden]
User-Agent: Google-HTTP-Java-Client/1.14.1-beta (gzip)

-------------- RESPONSE --------------
HTTP/1.1 200 OK
Date: Wed, 10 Apr 2013 21:15:53 GMT
Transfer-Encoding: chunked
Content-Encoding: gzip
Content-Type: application/json
Connection: keep-alive
Server: nginx
Cache-Control: no-cache, no-store

我的应用程序被配置为请求读取和写入权限。

4

2 回答 2

3

你能把网址从

https://api.box.com/2.0/folders/0

https://api.box.com/2.0/folders

于 2013-04-12T08:01:58.473 回答
-1

使用 C#.net 在 Box.net 中创建文件夹

静态字符串文件夹创建(字符串 APIKey,字符串 authToken){

    RestClient client = new RestClient();
    client.BaseUrl = "https://api.box.com/2.0/folders";
    var request = new RestRequest(Method.POST);
    string Headers = string.Format("Bearer {0}", authToken);
    request.AddHeader("Authorization", Headers);
    request.AddParameter("application/json", "{\"name\":\"Youka\",\"parent\":{\"id\":\"0\"}}", ParameterType.RequestBody);
    var response = client.Execute(request);
    return response.Content;



}
于 2014-02-25T12:59:47.450 回答