Download only one latest file in a box folder
AnsweredHi Team,
Is there any API to download only one recent modified file from Box folder?
I found this document but I see no option to download only last modified file.
https://developer.box.com/reference/get-files-id-content/
My requirement:
1. Developer uploads the new executables on a box folder always. And our ansible playbook need to download only last modified file always. How can we achieve that?
Thanks,
Nitesh
-
Official comment
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
Comment actions -
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
Please sign in to leave a comment.
Comments
3 comments