Gravatar for puneetpande@gmail.com

Question by ppande, Feb 11, 2015 11:53 PM

Coveo rest api help

Hi,

How do I go about building a query when using rest API? A simple search query would go something like: http://server/coveo/rest?q={search term}. If I want to add filtering based on a specific value of a specific field, how do I that. For example, if I want to add a parameter to above query and only pull items of a particular template: http://server/coveo/rest?q={search term} && templateId={some guid}.

I have looked at the queryparameter section. But it's lacking some good examples and I'm not sure how I would do that?

Thanks.

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Feb 12, 2015 4:25 AM

Query filters should be specified as part of the query, not through a dedicated query string argument. For example:

.../search?q=some search terms @foo==bar

You can use the aq parameter to specify those mandatory or machine generated filters instead of q. The resulting query will include expressions from both arguments, but using invalid in aq will raise an error, which can help troubleshooting.

Additional information about the query syntax is available here: http://onlinehelp.coveo.com/en/ces/7.0/User/coveoquerysyntax_reference.htm

Ask a question