Welcome to the new Box Support website. Check out all the details here on what’s changed.

Error when using Box SDK Java

New post

Comments

3 comments

  • mwiller

     The root folder cannot have metadata applied to it, and when you try making the request to get metadata on the root folder the API will respond with a 405 Method Not Allowed status code; is that the network error you're seeing?

    0
    Comment actions Permalink
  • ajitpandit88

    Thanks for your reply. My code is working now. Although some behavior I am not able to understand like - 

     

    Below Code does not work:

    BoxDeveloperEditionAPIConnection serviceAccountConnection = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig, accessTokenCache)==Gives Error
    BoxDeveloperEditionAPIConnection serviceAccountConnection = BoxDeveloperEditionAPIConnection.getAppUserConnection(User_Id, boxConfig, accessTokenCache)==Gives Error

     

    Below Code works:

    BoxDeveloperEditionAPIConnection serviceAccountConnection = new BoxDeveloperEditionAPIConnection(User_Id, DeveloperEditionEntityType.USER, boxConfig, accessTokenCache)

     

    Also, can you let me know if Box SDK works with Java 6. When I tried it gave me error for Jose dependency since its only supported on Java 7 onwards. Is there any alternative library that I can use to make my code work on Java 6?

     

     

    0
    Comment actions Permalink
  • mwiller

     The two static methods that you list as not working don't just construct the BoxDeveloperEditionAPIConnection, but they also craft a JWT and make the API request to exchange the JWT for an access token by calling the authenticate() method on the BoxDeveloperEditionAPIConnection.  If you're using an older version of Java that the SDK does not support, then it's probably that authenticate() method where the error is thrown.  This makes sense to me, because that method relies on jose4j to construct the JWT.  Unfortunately, the SDK does not support Java versions less than 7 and I'm not aware of any workarounds to use the necessary JWT functionality on older versions.

    0
    Comment actions Permalink

Please sign in to leave a comment.