How to search for Metadata multi-value through api?
AnsweredHi all,
I have a metadata template with a multi select field called series. It contains 3 value: ['A', 'B', 'C'] so user can select any of the value combo. I was able to assigned a few value to a few file through Box UI ok. When I query the file meta data, I get its array value assigned correctly. I'm having problem searching for it through API (I know web UI doesn't work: https://community.box.com/t5/Business-Apps-Forums/Searching-Metadata-Templates-with-Dropdown-Multiple-Select/td-p/57366), but was wondering if searching for metadata multi-value work through API?
I'm following this guide: https://developer.box.com/reference#searching-for-content
I have tried any of the 3 below method for series, always get 400 error. I tried using both box-sdk for node, and tried it manually in Postman directly with url encoded. Nothing works so far.
mdfilters: [{
templateKey: 'myTemplate',
scope: 'enterprise',
filters: {
series: 'A',
series: ['A'],
series: {
gt: 'A',
lt: 'A'
}
}
]
Thanks,
Kien
-
hey Matt is Single drop down search through API does not support as well? I just tried to split my fields into 3 single drop down filed, but I'm having the same 400 error when I try to search through API. For Single drop down, I can search through UI fine, but not API.
My example query:
const searchParams = { mdfilters: [ { templateKey: 'myTemplate', scope: 'enterprise', filters: { seriesA: 'true' } } ] } client.search.query('', searchParams);
I always get this error from box-node-sdk:
Unexpected API Response [400 Bad Request | 81i3alftvc0h4iwy] bad_request - Bad Request
-
I just found out internally, Box renamed camel case field!
In my case, it renamed `seriesA` => `seriesa`
After I update my code to search for lower case field instead of the field name assigned at UI, it works ok now. I hope this gets documented somewhere, super weird behavior, shouldn't do this at all.
-
Hi, multi-select metadata is now searchable via the Box API. Link: https://developer.box.com/reference/resources/metadata-field-filter-multi-select/
Please sign in to leave a comment.
Comments
6 comments