Box sign API create request invalid parameter
I am using box-java-sdk-3.1.2 to try and create a sign request. I am getting an error message in Eclispe that says bad request and it says to enter a valid folder. I've tried multiple folders by name and id and I havent been able to get passed this error.
Apr 27, 2022 2:41:22 PM com.box.sdk.BoxLogger warn
WARNING: Response
POST https://api.box.com/2.0/sign_requests
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
x-envoy-upstream-service-time: 501
vary: origin
x-frame-options: SAMEORIGIN
Connection: keep-alive
x-download-options: noopen
strict-transport-security: max-age=31536000
Date: Wed, 27 Apr 2022 19:41:22 GMT
access-control-expose-headers: WWW-Authenticate,Server-Authorization
set-cookie: csrf-token=HDH9rtYhD85BF4aRBbnqYEfrtINJ9XtbgukyZldE8jH; Secure; SameSite=Lax; Path=/
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
cache-control: no-cache
box-request-id: 0168c9ae4d2bc1a4a4a238eea20bf62cb
Content-Type: application/json; charset=utf-8
{"type":"error","code":"bad_request","status":400,"message":"Bad request","help_url":"http://developers.box.com/docs/#errors","request_id":"0168c9ae4d2bc1a4a4a238eea20bf62cb","context_info":{"errors":[{"message":"Enter a valid folder.","name":"parent_folder","reason":"invalid_parameter"}]}}
Exception in thread "main" com.box.sdk.BoxAPIResponseException: The API returned an error code [400 | 0168c9ae4d2bc1a4a4a238eea20bf62cb.0168c9ae4d2bc1a4a4a238eea20bf62cb] bad_request - Bad request
at com.box.sdk.BoxAPIResponse.<init>(BoxAPIResponse.java:95)
at com.box.sdk.BoxJSONResponse.<init>(BoxJSONResponse.java:33)
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:739)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:433)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:400)
at com.box.sdk.BoxSignRequest.createSignRequest(BoxSignRequest.java:150)
at com.box.sdk.BoxSignRequest.createSignRequest(BoxSignRequest.java:107)
at com.box.sdk.uploader.ViewSignRequests.main(ViewSignRequests.java:54)
Here is my code:
Logger.getLogger("com.box.sdk").setLevel(Level.ALL);
Reader reader = new FileReader("C:\\eclipse\\workspace\\Box\\bin\\config.json");
BoxConfig config = BoxConfig.readFrom(reader);
BoxDeveloperEditionAPIConnection api = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(config);
BoxUser.Info userInfo = BoxUser.getCurrentUser(api).getInfo();
System.out.format("Welcome, %s <%s>!\n\n", userInfo.getName(), userInfo.getLogin());
List<BoxSignRequestFile> files = new ArrayList<BoxSignRequestFile>();
BoxSignRequestFile file = new BoxSignRequestFile("123");
files.add(file);
List<BoxSignRequestSigner> signers = new ArrayList<BoxSignRequestSigner>();
BoxSignRequestSigner newSigner = new BoxSignRequestSigner("abc@abc.com");
signers.add(newSigner);
String destinationParentFolderId = "12345";
BoxSignRequest.Info signRequestInfo = BoxSignRequest.createSignRequest(api, files,signers, destinationParentFolderId);
I took out real file/folder names from this code.
投稿コメントは受け付けていません。
コメント
1件のコメント