# Locations

## Changes

Locations appear as the `location_grid` field on contacts and groups. The old `locations` field has been removed.

`location_grid` is a field of type 'location'. It is updated the same way connections are. See [Post Types Fields Format](https://github.com/DiscipleTools/disciple-tools-theme/wiki/Post-Types-Fields-Format) for more details

## Endpoints

### Search Locations

`GET` <https://example.com/wp-json/dt/v1/mapping_module/search_location_grid_by_name>

Requires permission: `access_{post_type}`

#### Parameters

* `s` (string): the string to filter the list to.
* `filter` (string): Options: `[ 'all' | 'focus' | 'used' ]`
  * `all`: return all geoname locations
  * `focus`: Anly return the locations included in the selected Mapping Focus
  * `used`: Only return locations currently used by contacts, groups (and other)

#### Returns

```javascript
{
  location_grid: [
   {
     ID : 6255147,
     name: 'Asia',
   },
   { ... location_grid_id 2 ... }
  ], 
  total: 339 // the total number of location_grid_ids matching the search
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.disciple.tools/theme-core/api-other/locations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
