Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

Requesting extra fields

Guides Search Requesting extra fields
Edit this page

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 => {
        // ...
    });

For more details on these fields, please check out the full File, full Folder, and full Web Link resources.

When the fields parameter is used to query additional information about the items, only those fields and a few base fields (id, type, name, etc) are returned. Any fields that were originally in the response would now have to be requested explicitly.