Skip to main content
Question

Search api is not returning custom metadata in response

  • May 22, 2025
  • 4 replies
  • 30 views

Forum|alt.badge.img

I am developing an application using box rest services.I have added custom metadata like(eid,comments,topic) to the files.
I want to search the files which are having key =eid,value=abcd1234 I am using below search api.
It is working good, but i am expecting the other metadata(comments,topic) to be included in response, but it is not including other custom metadata
(https://api.box.com/2.0/search?mdfilters=%5B%7B%22templateKey%22%3A%22customer%22%2C%22scope%22%3A%22enterprise_7133495%22%2C%22filters%22%3A%7B%22eid%22%3A%22abcd1234%22%7D%7D%5D)

Appreciate for quick response.

 

Thanks

Sydaiah N

4 replies

Forum|alt.badge.img

Hi  have you tried adding the `fields` query param? This will allow you to request extra fields in the response for each file, like the `metadata` object.


Forum|alt.badge.img

 I have tried with fields=modified_at,path_collection,name,metadata, but still not returning the metadata. Here is the URL:

https://api.box.com/2.0/search?mdfilters=%5B%7B%22templateKey%22%3A%22customer%22%2C%22scope%22%3A%22enterprise_7133495%22%2C%22filters%22%3A%7B%22eid%22%3A%22abcd1234%22%7D%7D%5D&fields=modified_at,path_collection,name,metadata

 

Here is response from service:

{"total_count":2,
"entries":
[{"type":"file","id":"508880648946","etag":"0","modified_at":"2019-08-16T11:01:05-07:00",
"path_collection":{"total_count":3,"entries":[{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"All Files"},
{"type":"folder","id":"8***phone number removed for privacy***","sequence_id":"0","etag":"0","name":"Secure Files"},
{"type":"folder","id":"84660484843","sequence_id":"0","etag":"0","name":"111"}]},
"name":"new 1.json"},
{"type":"folder","id":"8***phone number removed for privacy***","etag":"0","modified_at":"2019-08-15T12:51:26-07:00",
"path_collection":{"total_count":2,"entries":[{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"All Files"},
{"type":"folder","id":"8***phone number removed for privacy***","sequence_id":"0","etag":"0","name":"Secure Files"}]},"name":"444"}],
"limit":30,"offset":0}


Forum|alt.badge.img

 I had to do some digging.

 

To return a specific metadata template, use `fields=metadata.scope.templateKey`. You can combine this to fetch multiple results, e.g. `fields=metadata.global.properties,metadata.emteprise_12345.securityClassification-123123`.

 

To get all metadata on a file, use the file metadata endpoint, `/2.0/files/:file_id/metadata`.

 

 

 


Forum|alt.badge.img

Query param works for me