Hi,
I'm trying to programmatically download a file shared by a different Box account. The file is shared publicly, I can download it from a browser without entering any credentials or logging in.
But when I try the same via API by calling sharedItems.get, I'm getting shared_link=null. If I call getDownloadURL or getReadStream by file id, I get a 404 error. Tried via Node SDK and Postman, same result.
My guess: it's something wrong with permissions. I've tried using a developer token, also tried enterprise auth via a Box SDK config file, which includes clientID, clientSecret, private key and enterpriseID — same result. My app in Box developer console has all possible permissions (as far as I can tell).
Result of sharedItems.get:
{
type: 'file',
id: (...),
file_version: (...),
sequence_id: (...),
etag: (...),
sha1: (...),
name: (...),
description: '',
size: (...),
path_collection: { total_count: 0, entries: n] },
created_at: (...),
modified_at: (...),
trashed_at: null,
purged_at: null,
content_created_at: (...),
content_modified_at: (...),
created_by: (...),
modified_by: (...),
owned_by: (...),
shared_link: null,
parent: null,
item_status: 'active'
}
(note that it returns id, but no shared_link)
Result of files.getDownloadURL:
Error: Unexpected API Response 404 Not Found | (...)] not_found - Could not find the specified resource
Result of files.getReadStream:
Error: Unexpected API Response I404 Not Found | (...)] not_found - Could not find the specified resource
To recap: I'm getting the file ID from sharedItems.get, but cannot download it by id after that. shared_link field is null.
I'm close to just giving up on Box API altogether and making a bot that runs headless Chrome to download this file using a browser. Appreciate any help.
Thank you.