Skip to main content

public void CreateFolder(){

//BoxFolder folder = new BoxFolder('bbwh00nt6dylw1w8y1z7p0dnm4zd2m8n', '"Parent": {"id":"0"}');

HttpRequest request=new HttpRequest();

request.setendpoint('https://api.box.com/2.0/folders');

request.setmethod('POST');

request.setHeader('Authorization','Bearer ' + AccessToken);

string body= '{"name":"test", "parent": {"id": "0"}}';

request.setBody(body);

Http p=new Http();

HttpResponse response=p.send(request);

jsonFolderResponse=response.getBody();

System.debug('jsonFolderResponse'+jsonFolderResponse);

}

Hi am getting the following error can any one help out.

16:56:12:643 USER_DEBUG [49]|DEBUG|jsonFolderResponse{"type":"error","status":400,"code":"bad_request","context_info":{"errors":[{"reason":"invalid_parameter","name":"entity-body","message":"Invalid value '{\"name\":\"Test\",\"Parent\":\" {\"id\":\"0\"}\"}'. 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":"62736846156efda548b4e5"}

Thanks,

Ram
22 Antworten
  1. 20. Juni 2016, 19:47
    Thanks pcon am pretty new to cUrl i have to workaround that can share the related links that helps much

    is there any other way to do?any related code to store authcode and token generation using cURL?that helps me a lot
0/9000