Search Locations

Search Location records using field filters and free-text search.

Filtering & lookups

Any field listed below can be filtered on directly for an exact match (e.g. ?status=active), or suffixed with __<lookup> to use a Django-style lookup appropriate to that field's type (e.g. ?created__gte=2024-01-01). Only lookups valid for a given field's type are accepted; see that field's own description for the ones it supports.

| Lookup | Meaning | | --- | --- | | startswith / istartswith | Value starts with the given string (istartswith case-insensitive). | | endswith / iendswith | Value ends with the given string (iendswith case-insensitive). | | in | Value is one of a comma-separated list, e.g. ?id__in=1,2,3. | | gt / gte | Greater than / greater than or equal to. | | lt / lte | Less than / less than or equal to. | | range | Value falls between two comma-separated bounds, e.g. ?price__range=100,200. | | isnull | Field is/isn't null. Pass true or false. | | date | Matches the date part of a datetime field, e.g. ?created__date=2024-01-01. | | year / iso_year | Matches the (ISO) year of a date/datetime field. | | quarter | Matches the quarter (1-4) of a date/datetime field. | | month | Matches the month (1-12) of a date/datetime field. | | week / week_day | Matches the ISO week number, or day of the week (1=Sunday...7=Saturday). | | day | Matches the day of the month (1-31). | | time | Matches the time part of a datetime field. | | hour / minute / second | Matches that component of a time/datetime field. | | contained_by | Array/JSON field is fully contained within the given comma-separated values. | | overlap | Array field shares at least one element with the given comma-separated values. | | len | Matches the number of elements in an array field. | | has_key | JSON field contains the given top-level key. | | has_keys | JSON field contains all of the given comma-separated top-level keys. | | has_any_keys | JSON field contains at least one of the given comma-separated top-level keys. |

Combinator suffixes can be appended instead of (or in addition to) a lookup to control how a filter combines with the others on the request:

| Combinator | Meaning | | --- | --- | | or | Match this filter optionally — OR'd with the other filters instead of required. | | not | Exclude records matching this filter. | | ornot | Exclude records matching this filter, optionally (OR'd with other exclusions). | | and | Explicitly require this filter alongside the others (the default behaviour). |

HTTP Request

POST/locations/api/v1/locations/search/

Example Response

{
"count": 0,
"next": "http://www.example.com",
"previous": "http://www.example.com",
"results": [
{
"id": 0,
"province": "string",
"country": "string",
"area": "string",
"province_id": 0,
"country_id": 0,
"area_id": 0,
"province_slug": "string",
"country_slug": "string",
"area_slug": "string",
"portal_locations": [],
"suburb": "string",
"suburb_slug": "string",
"postal_code": "string",
"search_vector": "string"
}
]
}

NameDescription

search

string

Free-text search across the model's configured search fields

fields

string

Comma-separated list of fields to match the search/trigram query against

id

string

Filter results by exact id. **Allowed lookups:** `__or`, `__not`, `__ornot`, `__contained_by`, `__endswith`, `__gt`, `__gte`, `__iendswith`, `__in`, `__isnull`, `__isnullorempty`, `__istartswith`, `__lt`, `__lte`, `__range`, `__startswith`

province

string

Filter results by exact province. **Allowed lookups:** `__or`, `__not`, `__ornot`

country

string

Filter results by exact country. **Allowed lookups:** `__or`, `__not`, `__ornot`

area

string

Filter results by exact area. Also accepts any `area__<lookup>` suffix (e.g. `area__in`).

province_id

string

Filter results by exact province_id. **Allowed lookups:** `__or`, `__not`, `__ornot`

country_id

string

Filter results by exact country_id. **Allowed lookups:** `__or`, `__not`, `__ornot`

area_id

string

Filter results by exact area_id. Also accepts any `area_id__<lookup>` suffix (e.g. `area_id__in`).

province_slug

string

Filter results by exact province_slug. **Allowed lookups:** `__or`, `__not`, `__ornot`

country_slug

string

Filter results by exact country_slug. **Allowed lookups:** `__or`, `__not`, `__ornot`

area_slug

string

Filter results by exact area_slug. **Allowed lookups:** `__or`, `__not`, `__ornot`

portal_locations

string

Filter results by exact portal_locations. Also accepts any `portal_locations__<lookup>` suffix (e.g. `portal_locations__in`).

suburb

string

Filter results by exact suburb. **Allowed lookups:** `__or`, `__not`, `__ornot`, `__endswith`, `__gt`, `__gte`, `__iendswith`, `__in`, `__isnull`, `__isnullorempty`, `__istartswith`, `__length`, `__lt`, `__lte`, `__range`, `__startswith`

suburb_slug

string

Filter results by exact suburb_slug. **Allowed lookups:** `__or`, `__not`, `__ornot`, `__endswith`, `__gt`, `__gte`, `__iendswith`, `__in`, `__isnull`, `__isnullorempty`, `__istartswith`, `__length`, `__lt`, `__lte`, `__range`, `__startswith`

postal_code

string

Filter results by exact postal_code. **Allowed lookups:** `__or`, `__not`, `__ornot`, `__endswith`, `__gt`, `__gte`, `__iendswith`, `__in`, `__isnull`, `__isnullorempty`, `__istartswith`, `__length`, `__lt`, `__lte`, `__range`, `__startswith`

Responses

200
400 Bad request body
403 You do not have permission to perform this action
500 Internal server error
503 This website is not active