You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
bipalshakya
4 years agoExplorer | Level 4
Query Dropbox API with `select_user` URL parameter
Hi there!
So what I'm trying to do is query Dropbox using python's from dropbox import DropboxTeam's request_json_object API. I want to query the API path: files/list_folder.
My request dict...
- 4 years ago
[Cross-linking for reference: https://stackoverflow.com/questions/66247055/query-dropbox-api-with-select-user-url-parameter ]
First, note that you don't need to use `request_json_object` directly. You generally should use the native methods provided for each endpoint. In the official Dropbox Python SDK, for /2/files/list_folder, that would be `files_list_folder`.
And to set the the"Dropbox-API-Select-User" HTTP header when using the official Dropbox Python SDK, you should do so via the `DropboxTeam.as_user` method.
Greg-DB
Dropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/66247055/query-dropbox-api-with-select-user-url-parameter ]
First, note that you don't need to use `request_json_object` directly. You generally should use the native methods provided for each endpoint. In the official Dropbox Python SDK, for /2/files/list_folder, that would be `files_list_folder`.
And to set the the"Dropbox-API-Select-User" HTTP header when using the official Dropbox Python SDK, you should do so via the `DropboxTeam.as_user` method.
bipalshakya
4 years agoExplorer | Level 4
Hi,
Thanks for the prompt response.
The reason that I opted for request_json_object was that I would get JSON output, which is the format that I need the results in.
With the SDK however, I'd get a Dropbox object.
Is there a way that I could get the response from SDK in JSON? Or a way I could transform the Dropbox object response to JSON or python dictionary?
- Greg-DB4 years agoDropbox Staff
The methods for calling the API in the Dropbox Python SDK like files_list_folder don't offer the original JSON, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.
You can transform the information in the returned native object, such as ListFolderResult for files_list_folder, however you wish. You'd need to write the code to do so though, e.g., to build some JSON.
- bipalshakya4 years agoExplorer | Level 4
Thanks, Greg for the clarification.
Will proceed accordingly. Hoping that the API is updated to return JSON serializable object soon!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,912 PostsLatest Activity: 5 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!