Generate box.com upload widget programatically/automatically
I have a project in which I want to generate upload widgets for different
folders automatically (and by that I mean I want to generate them from my
application, and not to go each time on Box.com website and manually click
on the generate embeded widget code). Let me explain a bit: so, presume I
have 1 account from which I want my users to interact with Box.com. I am
working in a PHP environment, and I easily get my access token and my
refresh token. I managed to comply a small library of cUrl requests for a
simple file-handling process, but I recently saw that you can do it by
widgets generated from box.com. The view/download widget is easy to
generate for certain folders, but I'm having trouble with the upload
widget. I need to access Box.com website and manually click some links to
generate an uploading script.
Can I do it without manually clicking on links on the Box.com?
This is an example of generated upload widget from Box.com:
<script
src="https://YOUR_BOX_APP.app.box.com/embed/upload.js?token=TOKEN_GENERATED_FOR_UPLOAD&folder_id=YOUR_FOLDER_ID&w=385&h=385&i=&d=1&t=YOUR_TITLE&r=1"
type="text/javascript">
</script>
When I looked a bit inside that script, I saw that it uses the Box.com V1
uploading api, and not the V2 api.
As final questions: How can I generate that token from within the script
to actually map onto my folder id element? Is there any default token that
goes with any folder id I might use?
No comments:
Post a Comment