"code":"request_size_mismatch","message":"Request body size didn't match Content-Length 60"
when I try to create upload file session from salesforce org it show error 400
{"code":"request_size_mismatch","message":"Request body size didn't match Content-Length 60","request_id":"ac4834ae2bf00d1d2bd942dd4e389950"}
below is code -
String jsonBody = '{\"folder_id\": \"0\",\"file_size\": 104857600,\"file_name\": \"Project.mov\"}';
String url = 'https://upload.box.com/api/2.0/files/upload_sessions';
Http p1 = new Http();
HttpRequest request1 = new HttpRequest();
request1.setEndpoint(url);
request1.setMethod('POST');
request1.setHeader('Contect-type','application/json');
request1.setHeader('Content-Length', String.valueOf(jsonBody.length()));
request1.setHeader('Authorization','Bearer '+boxData.Access_Token__c);
request1.setBody(jsonBody);
System.debug('=====AccessT=='+boxData.Access_Token__c);
HttpResponse response1 = p1.send(request1);
please have a look as soon as possible
-
Hi Sandip
I think you get the error message because you are including the 'Content-length' header in your request and it doesn't match the size. You shouldn't have to include this header. See https://developer.box.com/reference/post-files-upload-sessions for required headers and request body. Try to remove it and see if that solves your problem
Rgds,
Peter Christensen, Platform Solutions Engineer, Box
投稿コメントは受け付けていません。
コメント
1件のコメント