Download only one latest file in a box folder

回答済み
新規投稿

コメント

3件のコメント

  • 正式なコメント
    Alex Novotny

    Hi Nitesh, 

    In order to use the download file endpoint, you would need to know the file id. You can use the search endpoint to search for files in a particular folder based on the updated date. The exact functionality you are looking for doesn't exist, but you can do the above to achieve the same results.  

    Thanks, 

    Alex, Box Developer Advocate

    コメントアクション パーマリンク
  • Nitesh Singhal

    Thanks @Alex for your response. I am trying to generate the access token to use this API call but it's giving me error.

    $ curl -i -X POST "https://app.box.com/oauth2/token" \
    > -H "Content-Type: application/x-www-form-urlencoded" \
    > -d "client_id=tylxxxxxxung57" \
    > -d "client_secret=yaSGxxxxxxmvxa" \
    > -d "code=J30xxxxxJz" \
    > -d "grant_type=authorization_code"
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 257 0 100 100 157 126 197 --:--:-- --:--:-- --:--:-- 326HTTP/1.1 400 Bad Request
    Date: Sun, 26 Sep 2021 05:53:01 GMT
    Content-Type: application/json
    Transfer-Encoding: chunked
    Connection: keep-alive
    Strict-Transport-Security: max-age=31536000
    Set-Cookie: box_visitor_id=61500abdc35992.86993060; expires=Mon, 26-Sep-2022 05:53:01 GMT; Max-Age=31536000; path=/; domain=.box.com; secure
    Set-Cookie: bv=OPS-44737; expires=Sun, 03-Oct-2021 05:53:01 GMT; Max-Age=604800; path=/; domain=.app.box.com; secure
    Set-Cookie: cn=26; expires=Mon, 26-Sep-2022 05:53:01 GMT; Max-Age=31536000; path=/; domain=.app.box.com; secure
    Set-Cookie: site_preference=desktop; path=/; domain=.box.com; secure
    Cache-Control: no-store

    {"error":"invalid_grant","error_description":"Auth code doesn't exist or is invalid for the client"}


    Not sure what's wrong here..! Can you please advise me on this?

    Thanks,

    Nitesh

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

    Ok I was able to fix this but now struggling with downloading the latest file from the folder as download API needs the <file id> and it will change everytime when the new files are pushed to Box.

    And I need to do it all via Ansible only.

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

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