Hello,
I am attempting to just do a basic upload of a single 102KB file named Photo.jpg using curl on Windows 10. I have the free account for now and created a custom app with "Standard OAuth 2.0 (User Authentication)" for authentication. The user is the Co-Admin.
For the token, I am currently just trying to get it to work with the "Developer Token" which I know is only active for 60 minutes.
Here is the syntax I am using:
curl -X POST https://api.box.com/2.0/files/content -H "Authorization: Bearer DEVTOKEN" -H "Content-Type:multipart/form-data" -F attributes="{"name":"Photo.jpg", "parent":{"id":"11446498"}}" -F file=@Photo.jpg
When I enter this, it just goes to the next line. I check my Box folder and there is nothing uploaded. I also tried to change the folder ID to "0" but that did not work either to place file on the root directory.
Any suggestions? I am desperate as I need to get this working soon for a work deadline to see if we want to change providers to Box.
Thank You!
Edit: Also, if I try the original syntax that is found on the Upload Files help page: then I get the following error:
C:\Users\Ahmed\Downloads\curl-7.72.0_2-win64-mingw\curl-7.72.0-win64-mingw\bin>curl -X POST https://api.box.com/2.0/files/content -H "Authorization: Bearer DEVTOKEN" -H "Content-Type:multipart/form-data" -F attributes='{"name":"Photo.jpg", "parent":{"id":"11446498"}}' -F file=@Photo.jpg
Error:
curl: (3) unmatched close brace/bracket in URL position 20:
parent:{id:11446498}}'
^
Thus that is why I changed the single quotation (') to double quotes (") but then stuck on what to do from here.
Edit 2: I have also tried to do it in Linux, and same thing where it will be blank:
curl -X POST https://api.box.com/2.0/files/content \
-H 'Authorization: Bearer DEVTOKEN' \
-H "Content-Type: multipart/form-data" \
-F attributes='{"name":"Photo.jpg", "parent":{"id":"121466666995"}}' \
-F file=@Photo.jpg
I am running the commands from the folder that has the file I want to upload to. I am stumped.