Content - Search API


Searching content

You can search textual content within public ContentPage items using the content search api.

Request parameters

The endpoint is located at api/content/search/ and requests are made via GET request.

The following parameters are supported.

  • q The text search query.
  • format optional – Can be ‘json’ or ‘html’. Defaults to json if request is an ajax request, to html if not.
  • perpage The number of items per page. Defaults to 25.
  • page The number of the current page. Defaults to 1.

Results in JSON

When you request results in JSON, the returned format will be like so:

{
  "perpage":25,
  "page":1,
  "total":89,
  "results":[
  {
    "name":"Content page title",
    "intro":"Content page intro",
    "photo":"//www.example.com/full/url/to/image-normal.jpg",
    "featured":true,
    "type":"page",
    "locale":"en_US",
    "permalink":"http://example.com/perma/link/to/contentpage/"
  }, ...
  ]
}

Results in HTML

When results are returned as an HTML document then you need to use the contentpage/searchresults.html template file to set up a design. Results will be available in the {{results}} variable as a standard zajFetcher object.

Outlast Web & Mobile Development (c) 2019 | Privacy Policy |