新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

Box Link validation using Boxsdk

新規投稿

コメント

3件のコメント

  • Rui Barbosa

    Hi Sruthy,

    Help me understand a bit better your use case.

    What do you mean by validating the shared link? Will you try to do an http request to all links and verify the response?

    Lets us know. 

    0
    コメントアクション Permalink
  • Sruthy Jayan

    Hi Rui,

    Yes , I tried different methods ex: http request , python request library basically batch code. I was not able to get a proper response when I run them using batch code.

    For Shared Links if its public then I get a 200 response else its 404.

    One more scenario is for the folders that I have no access and just have a shared link then its accessible through browser but through batch code its 404.

     

    0
    コメントアクション Permalink
  • Rui Barbosa

    That is odd indeed, and I was not able to replicate your situation.

    So I did some testing and created 3 folders:

    • shared link public
    • shared link invite only w/ a user assigned
    • an invalid shared link

    With this code in python:

    import requests

    def main ():
        response = requests.get(url_shared_public)
        print(f" {url_shared_public}: {response.status_code}")
        response = requests.get(url_shared_invite)
        print(f" {url_shared_invite}: {response.status_code}")
        response = requests.get(url_shared_invalid)
        print(f" {url_shared_invalid}: {response.status_code}")
    if __name__ == "__main__":
        main()

    I get:

     https://app.box.com/s/v07pox0ni0xhd1b7bunmo8rebtp6o5jk: 200
     https://app.box.com/s/srqei60fa5b2h8o3zrlrpfxmwgz0dzss: 200
     https://app.box.com/s/srqei60fa5b2h8o3zrlrpfxmwgz0dzsx: 404

     

    Even without any security context I'm getting a 200 code on a valid URL and a 404 on an invalid one.

    When you test in the browser, make sure you are using an incognito window just to be sure you're not logged in any account.

    For example the shared invite url first returns a 302 (redirect) and then the login page with 200

    Perhaps there is a more elegant way of doing this, but I still do not understand why.

    I wonder where do you get your shared links URL's and why you need to test them.

    Are you using the shared links somewhere else and in the mean time they were removed?

    Cheers

     

     

     

    0
    コメントアクション Permalink

投稿コメントは受け付けていません。