Skip to main content

I am trying to create a shared link for a file that I uploaded using this curl command:

 

curl -X POST https://upload.box.com/api/2.0/files/content -H 'Authorization: Bearer ' -H "Content-Type: multipart/form-data" -F attributes='{"name":"kat_test.pdf","parent":{"id":""},"shared_link":{"access":"open"}}' -F file=@test.pdf

 

The file is being uploaded with "shared_link" set to "null". Why?

 

Also I found SDK commands to create a shared link on a file but not a curl command. Our backend is in Go, so I am not able to use any of the existing SDKs. Is there a curl command I can run to create a shared link on file?



Hi ,


 


The first thing that I would check on here is whether there are restrictions in the admin settings preventing shared links from being created. If someone with admin permissions goes to the content & sharing section of the admin console you should see something like the following:


 


sharing.png


 


Just make sure that the permissions set there will allow you to actually create shared links.


 


For the cURL command to generate a shared link, you'll want to call the update file endpoint (cURL command on the right side of the screen) and send in the shared link object as you did below.


 


Hope that helps,


Jon




Thanks,  !

We found out that if we create a custom app with Oauth2+JWT authentication, it works.

Before we were using App Tokens, and that's when the API "fails silently" without creating a shared link. 



Reply