0

I am trying to setup a pre-configured folder for users in the Enterprise where the share options are limited to collaborators only.

This feature is available in the web interface in the folder properties form under the security tab: "Restrict shared links to collaborators only"

The box content API (v2) allows for the creation and modification of shared links, this works as expected; but it is not clear whether/how we can restrict the shared link options.

The API docs for folder update: developers.box.com/docs/#folders-update-information-about-a-folder appears to indicate that there is an access attribute on the folder in addition to the shared_link attribute:

access: Can be open or collaborators. Type: object

I am not sure what the object value would be if not the "collaborators" String.

I have tried:

curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN"  \
-H "As-User: USER_ID" \
-d '{"access": "collaborators"}' -X PUT 

and

curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN"  \
-H "As-User: USER_ID" \
-d '{"access": {"access": "collaborators"}}' -X PUT

both return a status 200, though they do not appear to do anything.

jwscott
  • 25
  • 7

1 Answers1

0

The access field is actually a sub-field of the shared_link field, which is why it's slightly indented in the documentation (this is kind of hard to see). If you want to create a shared link to a folder and restrict the access to collaborators, you can do so with a request like:

curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN"  \
-H "As-User: USER_ID" \
-d '{"shared_link": {"access": "collaborators"}}' -X PUT
Greg
  • 3,731
  • 1
  • 29
  • 25
  • Greg In the update folder documentation it lists two instances of the access attribute. The first: is clearly a sub-field of shared link – jwscott Jan 13 '15 at 16:43
  • Thanks Greg, I don't need to create shared_links, but your post confirms my suspicion that I can't restrict the shared link options via the API. In the update folder documentation it lists two instances of the access attribute. The first: - access The level of access required for this shared link. Can be open, company, collaborators. Type: string is clearly a sub-field of shared link. The second: - access Can be open or collaborators. Type: object Is, I guess, a sub-field of: folder_upload_email It appears the API does not expose the ability to restrict shared link options. – jwscott Jan 13 '15 at 16:50