Skip to main content

In the document example response it has the metadata





but when i search it did not return.


image

Hi @KenZync , welcome to the forum!



You question is not clear to me, if you could and elaborate a bit more.



In the mean time, because metadata is a vast subject, and to get the conversation started, here are a few articles around metadata:















Let us know if this helps.



Best regards


Thankyou! I just have to add fields into query, I was looking for return metadata in query so I added field=metadata.enterprise_id.templateKey and it return now!


Fantastic @KenZync



I’ve been doing quite a lot of research into metadata, and I’m curious about your use case.



Could you share some of the details of what are you trying to accomplish?



Best regards


So, I’ve been working on setting up a database for our game, and I’m trying to optimize the use of space. I’ve opted for a box-like structure to store data. Essentially, users can create folders and upload their content. Each piece of content follows the same metadata template.



Now, we’ve got this search feature on our site that needs to query all the uploaded content. The challenge I’m facing is that each content file (which has its own custom extension) also has an associated image stored separately within it. We’ll need to display these images as thumbnails later when users search.



I’m thinking the best approach is to add another piece of metadata called “image_id” which would link to the image uploaded at the same time as the content. This way, we can efficiently associate each content item with its respective thumbnail image.



What do you think?


Hi Ken



Sounds like a plan. Definitely doable.



Just a heads up. It might take a few minutes for Box to index the newly created metadata.



For example if you add metadata to a file (add the template + fill in the data) it might not show up immediately in the search. It can take a few minutes.



Cheers


Just to add:


If your search criteria is only against Metadata values, the Metadata Query endpoint (https://developer.box.com/reference/post-metadata-queries-execute-read/) might also be worth exploring.



Here’s a page that outlines some key differences between Box Search and Box Metadata Query: https://developer.box.com/guides/metadata/queries/comparison/



In both cases (Search and Metadata Query), if you don’t want to deal with the full Metadata Instance attached to the file/folder, you can specify the field you want returned using the format of:



fields=metadata.<templateScope>.<templateKey>.<fieldKey>



Example: Say, for Enterprise ID 444555666 you have the Enterprise-scoped Template with TemplateKey of “contentProviderInfo” that has field keys of “contentAuthor”, “contentExpirationDate”, and “image_id”.



If you specify metadata.enterprise_444555666.contentProviderInfo, your results will include all of the key/value pairs of the “contentProviderInfo” Metadata Instance that is attached to the file/folders in your result set.



If you specify metadata.enteprise_444555666.contentProviderInfo.image_id, your results will include the key/values pairs for the image_id field, but not the key/values for the “contentAuthor” nor “contentExpirationDate” fields.


Thank you but I’m also doing a fuzzy search also, that endpoint may not my best approach


Reply