API Searching

Dexter makes an endpoint available for searching outside of ExpressionEngine templates. The URL is presented at the bottom of the Dexter Dashboard page in your control panel. It will be a typical ExpressionEngine action request, e.g. https://mysite.com?ACT=123.

You can use GET or POST requests. If you are using POST, the secureSearch setting will be enabled by default and will expect a valid CSRF token to be sent in the body of the request. You will need to acquire the current token and add it to your request. For example:

{
    "index": "test_files",
    "query": "small birds",
    "csrf_token": "[token string here]",
    "filters": {
        "limit": 6,
        "hybrid": {
          "embedder": "fullText"
        }
    }
}

GET requests do not require a CSRF token. Since you're simply performing a search a GET request is generally accepted, however, if you are using a large filters object, it is recommended to use a POST request. GET requests have the benefit of being sharable URLs, but depending on the complexity of your search filters you may want to consider a POST request. An example GET request will need to have the filters be a valid JSON object that is url encoded. For example:

https://mysite.com/?ACT=138&index=test_files&query=small birds&filters=%7B%22limit%22%3A6%2C%22hybrid%22%3A%7B%22embedder%22%3A%22fullText%22%7D%7D

Last updated

Was this helpful?