Craft CMS combining element-api and Simple Map plugin I've been using element-api for simple lazy-loading of things like blog posts, etc and now want to create a simple 'Postcode lookup' by utilising a custom filter (provided by the Simple Map plugin).

Simple Map provides a custom field that uses the Google Maps API for address data and geolocation.

My question is this: How would I call the custom Simple Map filter using the 'criteria' settings in element-api so that I can pass through a postcode (via a javascript call to the api/customer-search.json?postcode=M25ND) and return results based on the custom field filter?

I'm using Craft 3:

"require": {
    "php": "&gt;=7.0.0",
    "craftcms/cms": "^3.0.0-RC1",
    "vlucas/phpdotenv": "^2.4.0",
    "roave/security-advisories": "dev-master",
    "craftcms/redactor": "1.0.0.1",
    "craftcms/element-api": "^2.5",
    "ether/simplemap": "^3.1"
},


element-api
https://github.com/craftcms/element-api

simple map https://github.com/ethercreative/simplemap

The below will return entries that are within 100 miles of the location provided:

{% set entries = craft.entries.map({
    location: 'M2 5ND',
    country: 'GB',
    radius: 100,
    unit: 'mi'
}).orderBy('distance').all() %}


.. and the simple look up in my element-api.php file currently returns all 'customer' entries:

&lt;?php

namespace Craft;

use craft\elements\Entry;

// https://github.com/ethercreative/simplemap
// https://github.com/craftcms/element-api

return [
    'defaults' =&gt; [
        'elementType' =&gt; Entry::class,
        'elementsPerPage' =&gt; 9,
        'pageParam' =&gt; 'pg',
        'resourceKey' =&gt; 'entries',
        'transformer' =&gt; function(Entry $entry) {
            return [
                'id' =&gt; $entry-&gt;id,
                'title' =&gt; $entry-&gt;title,
                'url' =&gt; $entry-&gt;url,
                'map' =&gt; $entry-&gt;map,
            ];
        },
    ],
    'endpoints' =&gt; [
        'api/customer-search.json' =&gt; [
            'criteria' =&gt; [
                'section' =&gt; 'customers',
                'type' =&gt; 'customer',
                // how to include map({}) filtering of results?
            ],
        ],
    ]
];


What I'm struggling to do is combine the two. As far as I can tell; element-api criteria only works with the parameters listed here: https://craftcms.com/docs/templating/craft.entries

Thanks in advance for any direction you can provide.
It should work the same way because the modifyElementsQuery should be fired no matter where the ElementQuery object is build so you could insert the same array in your element-api endpoint as you insert in your CraftVariables entries function to  build the EntryQuery since they both use Yiis configure function to build the 

'endpoints' =&gt; [
    'api/customer-search.json' =&gt; [
        'criteria' =&gt; [
            'map' =&gt; [
                'location' =&gt; 'M2 5ND',
                'country' =&gt; 'GB',
                'radius' =&gt;  100,
                'unit' =&gt; 'mi'
            ],
            'orderBy' =&gt; 'distance'
        ],
    ],
]


should theoretically build the same object like 

{% set entries = craft.entries.map({
    location: 'M2 5ND',
    country: 'GB',
    radius: 100,
    unit: 'mi'
}).orderBy('distance') %}