Trying to create webhook with Box CLI - getting 404 error

新規投稿

コメント

6件のコメント

  • jcleblanc

    Hi ,

     

    This is mainly an assumption, but I'd say that this is most likely due to a scoping issue. In short, when you configured the CLI (box configure:environments:add) with the JSON file you downloaded from the app you created, that is scoping the CLI for your app (the service account) and not your user. Basically the files / folders that the CLI is referring to are those owned within the service account, and I'm guessing that you are trying to refer to files / folders that are owned by one of your users? The service account by default will not have access to those assets unless you add it as a collaborator.

     

    If all the above sounds correct to your situation, try running the webhook create command with the as-user flag of the user that owns the file / folder. Basically it'll look like this:

     

    box webhooks:create folder $FOLDER_ID --triggers="ITEM.CREATE,ITEM_UPLOAD" --address="https://VaidURLthatworks" --as-user=$ID_OF_USER_WHO_OWNS_CONTENT

    Hope that helps,

    Jon

    0
    コメントアクション パーマリンク
  • newtobo-x2019

    Hi Jon, appreciate your quick response. It could still be a scoping issue as you suggested but I have not created created any user yet. The folder and files I am testing with have been created by me directly which I assume would have used the service account. Regards

     

    0
    コメントアクション パーマリンク
  • jcleblanc

     did you create the files / folders using the CLI or did you create them on the box.com web app (or other like source)? 

    0
    コメントアクション パーマリンク
  • newtobo-x2019

    Directly on the box.com website

    0
    コメントアクション パーマリンク
  • jcleblanc

     ok perfect, then yes it's most likely a scoping issue. The service account behind the scenes is like a programmatic user account (app user) and thus it has its own file storage. The command I provided should work, and here's how you get your user ID for the --as-user flag: 

    1. Go to box.com and log in. Click on your picture / icon at the top right of the page and select "Account Settings" from the drop down menu.
    2. Scroll down to the account details section. In that section there should be an item for "Account ID" - that's your user ID. Use that # for the --as-user call and it should hopefully work.

     

    0
    コメントアクション パーマリンク
  • newtobo-x2019

    Hi Jon thanks for being patient (:

    What you suggested did not work as expected but it definitely looks like a scoping issue. Let me try to articulate my confusion here. Still trying to wrap my head around what may be going on here.

    1) Folder created on the box.com site using my service account

    2) Created a web app with jwt authentication as suggested. Created the configuration file with public private key.

    3) Configured the CLI environment with the above json config file

    4) Ran the create webhook command pointing to a folder created in #1. Like you said earlier since it is a differnt account in Box's view it did nit see the folder - error 404 not found

    5) Tried creating a folder using the CLI, creation successful, but don't know how to see that folder(creation details as follows

        Type: user
        ID: '***number removed for privacy***'
        Name:
        Login: ***email address removed for privacy***

    6) Tried creating the webhook again using the --as-user= parameter as you sugested with the account ID - 403 Forbidden error now instead of 404 that I used to get

    7) Changed the user ID to the ID that I got from the folder creation detail using CLI(the app id) I get this error: Unexpected API Response [403 Forbidden | fabcdf3wx57y] access_denied_insufficient_permissions - Access denied - insufficient permission

    😎 Tried creating a webhook on a folder created using the CLI then also the same  insufficient permission error

     

    Confused User (:

     

     

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。