Reputation: 31
I am using box API to get the meta-data for files stored in a box folder. When I make the API call, I get all the metadata including the download URL, but it is null for all files.
I have to manually go to each file, and then have to click on share link to generate their download URL. Is it possible to auto-generate download URL for a file as soon as it arrives in the box folder??
Upvotes: 3
Views: 4281
Reputation: 2087
You can use the API to generate a download URL for each file you want to make available for download. When your app downloads the metadata, it could check to see whether a download URL link is present. If not, then it could create the link. The URL request you would send should look something like this in cURL:
curl https://api.box.com/2.0/files/29985317831 -H "Authorization: Bearer AUTH_TOKEN" -d '{ "shared_link": { "access": "open" } } -X PUT
The Box API will respond with updated JSON metadata for the file, including the url link. For more information, see this link to the API docs: https://box-content.readme.io/#create-a-shared-link-for-a-file
Upvotes: 1