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

Instantiated Node.js Box SDK (via JWT) Inside of a Box Skill Application Returns 404 on File Access

New post

Comments

4 comments

  • RyanJ
    API calls listed as well: 
     
    var templateResponse = await client.metadata.getTemplates("enterprise", function(error, response) {
        if(error)
        {
            console.log("Error: ", error);
        }
        else
        {
            console.log("Succeeded getting all templates. Response - ", response);
        }
    });

    var fileResponse = await client.files.get(fileId, function(error, response) {
        if(error)
        {
            console.log("Error: ", error);
        }
        else
        {
            console.log("Succeeded getting file info. Response - ", response);
        }
    });

    var writeResponse = await client.files.addMetadata(fileId, "enterprise", "metadatasearchtemplate", metadataValues, function(error, response) {
        if(error)
        {
            console.log("Error: ", error);
        }
        else
        {
            console.log("Succeeded writing metadata back to box. Response - ", response);
        }
    });
    0
    Comment actions Permalink
  • rsweeney

    Hey , it sounds like the account you are making calls from does not have access to the content you are making calls to.  This article goes into this in a bit more detail:

    https://community.box.com/t5/Developer-Troubleshooting/API-Content-API-404-quot-not-found-quot-Errors-from-the-Box-API/ta-p/53318

     

    I suspect if you invite the account making these calls as a collaborator to the content you are trying to access then you should be good to go.  My guess is that you are making the calls from your service account since you're using a JWT application.  More on service accounts here:

    https://developer.box.com/docs/service-account

    0
    Comment actions Permalink
  • RyanJ

    ,

     

    Thank you for the response and the enlightening information about service accounts vs. user accounts. I was indeed making API calls from my service account without enterprise level permissions enabled. I have since enable enterprise level permissions, activated "Perform Actions as Users", activated "Generate User Access Tokens", and reauthorized the app. Despite making these changes, I am still hit with a 404 when accessing user files. I have also tried generating a userClient for the managed user of this application and I am met with a 400 response of "Unexpected API Response [400 Bad Request] invalid_request - Cannot obtain token based on the enterprise configuration for your app". Based on the configuration that I have specified above, I am unsure as to why I am met with this response. Do you have any other clarification on this? **Configuration pictured below

     

    Configuration.PNG

    0
    Comment actions Permalink
  • Kourtney

    Hey  , 

     

    If you haven't already, I would recommend opening up a support ticket at support.box.com so we can take a closer look with you and further assist! 

     

    Best, 

    Kourtney

    Box Technical Support Engineer

     

    0
    Comment actions Permalink

Please sign in to leave a comment.