我正在尝试使用 api 版本 2 从 salesforce 中的控制器类在 Box 中创建一个新文件夹。我正在接收访问令牌,并且我还能够通过 HTTP GET 请求检索文件夹的项目。但我无法在 BOX 中创建新文件夹。也无法将文件从一个文件夹复制到另一个文件夹或更新有关文件夹的信息。以下是更新我的文件夹描述的代码:
Http h = new Http();
HttpRequest req = new HttpRequest();
string endPointValue = 'https://api.box.com/2.0/folders/myfolder_id';
req.setEndpoint(endPointValue);
req.setHeader('Authorization', 'Bearer ' + myaccessToken);
req.setBody('description=' + EncodingUtil.urlEncode('New', 'U`enter code here`TF-8'));
req.setMethod('POST');
HttpResponse res = h.send(req);
I am getting the following response:
{"type":"error","status":400,"code":"bad_request","context_info":{"errors":[{"reason":"invalid_parameter","name":"entity-body","message":"Invalid value 'description=New'. Entity body should be a correctly nested resource attribute name\/value pair"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Bad Request","request_id":"my request Id"}
Can anyone help me on this?
Thanks in advance!