0
我正嘗試使用api版本2在salesforce中的控制器類中創建Box中的新文件夾。我正在接收訪問令牌,並且我也能夠使用HTTP GET請求檢索文件夾的項目。 但我無法在BOX中創建新文件夾。也無法將文件從1個文件夾複製到另一個文件夾或更新有關文件夾的信息。 下面是更新我的文件夾的描述的代碼:Box.com使用api v2從salesforce創建/更新文件夾
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!
謝謝伊萬!這工作:) – user3607700