API Code to Upload file to the anonymous upload file url
the box WebUI permits the creation of an upload URL (file request link; eg https://acme.app.box.com/f/6f5c1bcf424636e4ae9347504a7c2258 )which can then be sent to an anonymous person for them to upload file(s) into. There is no login screen or any credential required. I'm wanting to implement an automated upload of information into some client-side support applications whereby they only require this URL for. Pretty much all the examples and items I can find require a client session with a bearer token or some sort of OAuth login.
regards,
John
-
Hello,
Unfortunately, it doesn't look like the API allows that right now. You can add the feature request to Pulse. Box uses that to creates our future roadmap.
Thanks,
Alex, Box Developer Advocate
-
thanks for the feedback. In the meantime what would you recommend as an implementation pattern to achieve:
- a client software package is written in python which only leverages REST API calls to
- send a file (generally less than 50MB but could be much larger on occasions) to
- a client-specific box read-only folder, this is a preference but not a hard requirement,
- a fallback similar to the 'file request' customizable page in case the platform that is sending the file does not have direct internet access
- a simple method of creating and sharing client-level credentials but on the same box account which restricts them to that folder
wrt create a Pulse feature request; my corporate okta enabled account does not permit me login access to pulse.box.com can you add this feature request for me?
Subject: API Implementation for a file upload to the 'file request' URL.Group: Uploads
Detail:
Provide API Access for file upload to the 'file request' URL. The existing file upload API does not provide a method for anonymous uploads to a 'file request' link. Both the bearer token and folder id are not known and are not available within the URL.
a possible solution would be to implement an 'OPTIONS' call to the URL to return a throw-away bearer token and the folder id so that the existing file upload API calls can be used.regards,
John.
-
Okay. I added your suggestion.
In terms of recommending an implementation pattern, I would actually reach out to our Box Consulting team. They help development teams design solutions all the time.
-
Thanks, Alex,
I ended up finding a mix of documented and undocumented API calls that achieved what I was hoping to achieve. for me the following approach works; it's not as clean as I would have hoped but it works.
- Get the folder.id and a form.versionId from call to
https://datarobot.app.box.com/app-api/file-request-web/public/file-request?urlId=<file request id>
- Get the Bearer Token from a call to
https://datarobot.app.box.com/app-api/file-request-web/public/form-response
- Upload the file using the regular file upload API now that we have sufficient info to use it
https://upload.box.com/api/2.0/files/content
I was modified my file-request app to require an email address to also be submitted, and altered the call to the form-response to include this in the seeded info for the file upload but it never really applied this email address to the uploaded file; this would have been a 'nice to have' thing but for the moment all is good.
thanks for adding the request for me.
regards,
John.
- Get the folder.id and a form.versionId from call to
Please sign in to leave a comment.
Comments
5 comments