Uploading file to shared folder
AnsweredHi,
I am trying to upload files to a folder that my app has the ability to see a shared folder with get_shared_item(), but when I try to use this line:
I get a 404. Is this the correct way that I would upload a stream as a file to a shared folder? The 404 says that d_{shared_folder.id} is not found. I am using the JWT auth method with the Python SDK if that matters.
Thanks!
Stephen Stern
-
Hello ,
Thanks so much for using our platform and development forum!
Without having more information, I assume you're probably making calls using a token for the service account (AutomationUser) of your JWT application. A 404 like this usually indicates that the service account has not been added as a collaborator on the folder ID you're passing, as the service account can only interact with content it's been given access to.
If this isn't the case, could you please provide the full body response you receive (including the request ID) and a date/time/timezone you receive the error. I'd be happy to take a look at our backend logs for you to see if we can get you some more information!
Best,
Kourtney
-
When working with shared items, you need to include the shared link in all API calls made to have permissions on the item. You can use the `client.with_shared_link()` method, like this:
shared_item_client = client.with_shared_link(shared_link) uploaded_file = shared_item_client.folder(shared_folder.id).upload_stream(test_file, "upload_test.txt")
Note that this will only work if the shared link grants you upload permissions; this may not be the case.
-
Hi ,
Awesome, I'm getting a new error. I am getting an insufficient permission error, which is what I would assume you were talking about. This service account is the owner of the link, so I think I should be able to change its permissions. Where is the option to allow uploading with shared links? I can't seem to be able to find it either in the folder settings or the shared link settings.
Thanks!
-
I'm not aware of the ability to upload files into a shared folder, and the API docs don't show a way to set that permission. If the Service Account owns the folder the link points to, why do you need to use the shared link? You should just have permission to upload into the folder or collaborate whoever needs upload access into the folder directly.
-
Hi ,
Good to know that uploading to a shared folder isn't a thing. I guess that because it is a service account, the folder space that it has access to is something that only box-admin have access to, not what I can see when I go to the UI file store. Since I can't upload to a shared folder, I will just get access to get the info to as-user write into the folders. Thanks!
Please sign in to leave a comment.
Comments
7 comments