Successfully get folder ID of public shared folder, but can't get items, ID in message has d_ prefix
I’m trying to download the files of the publicly shared KUL fall simulation dataset (Box), as I access the server I want to run my AI training on via ssh and of course don’t have a browser there. Also I’d like to avoid copying 20GB of videos via ssh or something.
My app successfully authenticates and obtains the folder ID from the shared link using client.get_shared_item(shared_link), it returns “44028703597” as the folder ID.
Then I call folder_items = client.folder(folder_id).get_items(), no problems here.
Now when I try to iterate over that, I get an error message that the folder with the ID “d_44028703597” can’t be found, which is weird because in the same message I can see that the SDK calls GET https://api.box.com/2.0/folders/44028703597/items?offset=0, without the d_ prefix.
Any idea what I’m doing wrong? My app has read permission, I can’t see anything else it might need to read public files.
It means that the user doing the API call doesn’t have the permissions accessing the files.
Hi, thanks for checking! The files are shared publicly and I can even download them via browser without any login, then how can the user not have permission to download them? Or do I need a different endpoint for shared files?
Yes, indeed.
Only the owner or collaborators can access the folder endpoint.
Given that you’re trying access the folder with another account, it won’t work.
To access the files, you need to be a collaborator on the folder.
Then which endpoint should I use to get the files (or download the zip) via the shared link? I can’t find a fitting endpoint in the API reference.
If you need the File ID you can use the Shared Link endpoint :
If you have the File ID, you can use the Download endpoint :
Following up on this thread, looks like Kuleuven might have updated their security settings, and I was able to come up with a python script, as an example, that will download each file:
Due to the number of files, you’ll probably need to adapt the script to check if the file has already been completely downloaded, just in case it fails or you want to do this in chunks.
Let us know if this helps.
I was using the classic Python SDK and JWT authorization.