oauth 2.0 - How do I upload a file using the Box API using app credentials? -


i want user upload our server , have our server upload file specific folder in box using api. how can this? credentials should use?

curl https://app.box.com/api/oauth2/token \ -d 'grant_type=client_credentials&client_id=client_id&client_secret=secret' 

returns

{"access_token":"token","expires_in":3793,"restricted_to":[],"token_type":"bearer"}

curl https://upload.box.com/api/2.0/files/content   \ -h "authorization: bearer token" -x post  -f \  file=@package.json -f folder_id=3306197480 

returns

{"type":"error","status":404,"code":"not_found","context_info":{"errors":[{"reason":"invalid_parameter","name":"parent","message":"invalid value 'd_3306197480'. 'parent' value 'd_3306197480' not found"}]},"help_url":"http://developers.box.com/docs/#errors","message":"not found","request_id":"1157604954550c7c754b9c9"}

it sounds api returning 404 because user associated access token doesn't have permissions see folder you're uploading to. server need authenticate user collaborated on folder instead of authenticating user uploading file.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -