Requesting extra fields
Requesting extra fields
By default, the search API returns the standard format of a
File, Folder, or Web Link. Each of
these resources supports additional fields that can be requested through the
fields
query parameter.
cURL
curl -i -X GET "https://api.box.com/2.0/search?query=sales&fields=name,tags" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
Java
long offsetValue = 0;
long limitValue = 10;
BoxSearch boxSearch = new BoxSearch(api);
BoxSearchParameters searchParams = new BoxSearchParameters();
searchParams.setQuery("sales");
final List<String> fields = new ArrayList<String>();
fields.add("name");
fields.add("tags");
searchParams.setFields(fields)
PartialCollection<BoxItem.Info> searchResults = boxSearch.searchRange(offsetValue, limitValue, searchParams);
.NET
IEnumerable<string> fields = new List<string>() { "name", "tags"};
BoxCollection<BoxItem> results = await client.SearchManager
.QueryAsync("sales", fields: fields);
Python
client.search().query("sales", metadata_filters=metadata_search_filters, fields=["name", "tags"])
Node
client.search.query(
'sales',
{
fields: "name,tags"
})
.then(results => {
// ...
});