Hi,
I am new to the box api. I have gone through the java box sdk and trying out to get connection with box with java client. I am simply printing the root folder in the below code but it is throwing an error:
package com.box.api.test;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import com.box.sdk.BoxAPIConnection;
import com.box.sdk.BoxConfig;
import com.box.sdk.BoxFolder;
public class BoxAPIConnectionTest {
public static void main(String[] args) throws IOException {
Reader reader = new FileReader("resources/config.json");
BoxConfig boxConfig = BoxConfig.readFrom(reader);
BoxAPIConnection api = new BoxAPIConnection(boxConfig);
BoxFolder root_Fol=BoxFolder.getRootFolder(api);
System.out.println(root_Fol.getInfo().getID());
}
}
Error:
Exception in thread "main" com.box.sdk.BoxAPIResponseException: The API returned an error code [401 | .08e718937be17e68094d8f7a2c2ee84c]
at com.box.sdk.BoxAPIResponse.(BoxAPIResponse.java:92)
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:577)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:354)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:329)
at com.box.sdk.BoxFolder.getInfo(BoxFolder.java:288)
at com.box.api.test.BoxAPIConnectionTest.main(BoxAPIConnectionTest.java:16)
could you please assist that what would be the issue in my code?
