Curious about A, B, C, and D drives? Learn what they mean and how to use them effectively with Dropbox in this handy guide! - check it out now!
Forum Discussion
toki4004
2 years agoHelpful | Level 5
Error: property_groups: expected list, got string
I am trying to add property groups to a file with
https://content.dropboxapi.com/2/files/upload
and I am getting an error "HTTP header "Dropbox-API-Arg": property_groups: expected list, got stri...
- 2 years ago
toki4004 wrote:..., and now I want to view a folder list with items + see their properties. I get this error:
- "Error in call to API function "files/list_folder": request body: include_property_groups.filter_some: expected list, got string".
- Here is my code below. What format is expecting for "include_property_group"?
...
Even when you have one property group it should be a list with one entry, not just a single string, as you have passed. If you take a look on 'filter_some', you will see that expected type is list, not something else (list of ids, not just one id itself - even when it's alone). Wrap your id' string with array.
Здравко
2 years agoLegendary | Level 20
toki4004, did you prototype your calls? As seems not yet... Yes, property group is list/array. The elements of this list are dicts. The fields of each element is list also.
Take a bit more care. 🙋
toki4004
2 years agoHelpful | Level 5
I am trying to but I get that error 400 - it's asking for template_id. What template is it referring to?
- Greg-DB2 years ago
Dropbox Staff
toki4004 The 'property_groups' parameter on the /2/files/upload endpoint is optional. (You can find that in the documentation for /2/files/upload.) You should only set it if you are using the "file properties" feature. If you do set the 'property_groups' parameter though, the 'template_id' field in any given PropertyGroup object is required and must not be empty.
You can find information on the file properties feature, such as what templates are and how to work with them, in the documentation for it here.
- toki40042 years agoHelpful | Level 5
Greg-DB Ah, ok, so the template is required. I guess I'll have to set that.
My end goal is to assign a custom meta data to a file/folder. It sounds like I'll need to set template and then deal with that property.
- Здравко2 years agoLegendary | Level 20
Also don't nest lists one in other directly..
- toki40042 years agoHelpful | Level 5
Where before I was getting en error
property_groups: expected list, got string
now with this change:
$meta = array( array("cat", "dog") ); $fields = array( "path" => "/ba.txt", "autorename" => false, "mode" => "overwrite", "mute" => false, "strict_conflict" => false, "property_groups" => $meta );
I am getting:
property_groups: expected object, got list
So now it's NOT expecting a list...? I am confused on the format that it wants to receive.- Greg-DB2 years ago
Dropbox Staff
toki4004 The "property_groups: expected object, got list" error is referring to the items in the property_groups list; the items are supposed to be objects of type PropertyGroup, but you're instead supplying a list via `array("cat", "dog")`.
It should look more like this:
$meta = array( array("template_id" => "ptid:TEMPLATEID", "fields" => array(array("name" => "FIELDNAME", "value" => "FIELDVALUE"))) );
You'd need to replace the CAPITALIZED values with your actual values of course.
- toki40042 years agoHelpful | Level 5
I created a template in my app and got a response with a template id. I can also make a call in my app "get_for_user" and view the schema for the new template. BUT when I go to your API explorer, I get nothing back
templates/list_for_user:"template_ids": []
Also, get_for_user:
{ "error_summary": "restricted_content/..", "error": { ".tag": "restricted_content" } }
Why am I able to get_for_user via my app but not the explorer?
Also, can you please explain: does the add_template needs to be called only once and then it's stored? If yes, until you delete it?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,956 PostsLatest Activity: 56 minutes ago
If 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!