How to automatically generate a file download url as a file?

I am using box API to get metadata for files stored in a folder with folders. When I make the API call, I get all the metadata including the download url, but it is zero for all files.

I need to manually navigate to each file and then click on the share link to create the download url. Is it possible to automatically generate a download URL for a file as soon as it appears in the folder with the folder?

+3


source to share


1 answer


You can use the API to create a download URL for each file you want to make available for download. When your app downloads metadata, it can check if a link to the download url is present. If not, then he can create a link. The url request you sent should look something like 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. For more information see this link in the API docs: https://box-content.readme.io/#create-a-shared-link-for-a-file

+1


source







All Articles