# Locations

## GET /locations/{siteId}

> Get all locations for a site (nested children)

```json
{"openapi":"3.0.3","info":{"title":"Incident Tracker API","version":"1.0.0"},"servers":[{"url":"https://api.kitehouse.co.uk"}],"paths":{"/locations/{siteId}":{"get":{"tags":["Locations"],"description":"Get all locations for a site (nested children)","parameters":[{"schema":{"type":"boolean"},"in":"query","name":"with_occupants","required":false},{"schema":{"type":"boolean"},"in":"query","name":"with_type","required":false},{"schema":{"type":"boolean"},"in":"query","name":"with_children","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}}}}
```

## POST /locations/{siteId}

> Create a new location

```json
{"openapi":"3.0.3","info":{"title":"Incident Tracker API","version":"1.0.0"},"servers":[{"url":"https://api.kitehouse.co.uk"}],"paths":{"/locations/{siteId}":{"post":{"tags":["Locations"],"description":"Create a new location","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"parent_code":{"type":"string"},"parent_id":{"type":"string","nullable":true},"erp_code":{"type":"string"},"description":{"type":"string"}},"required":["name","code","type","status"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}}}}
```

## DELETE /locations/{siteId}/{locationId}

> Delete a location

```json
{"openapi":"3.0.3","info":{"title":"Incident Tracker API","version":"1.0.0"},"servers":[{"url":"https://api.kitehouse.co.uk"}],"paths":{"/locations/{siteId}/{locationId}":{"delete":{"tags":["Locations"],"description":"Delete a location","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationId","required":true}],"responses":{"200":{"description":"Default Response"}}}}}}
```

## PATCH /locations/{siteId}/{locationId}

> Update a location

```json
{"openapi":"3.0.3","info":{"title":"Incident Tracker API","version":"1.0.0"},"servers":[{"url":"https://api.kitehouse.co.uk"}],"paths":{"/locations/{siteId}/{locationId}":{"patch":{"tags":["Locations"],"description":"Update a location","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"parent_code":{"type":"string"},"parent_id":{"type":"string","nullable":true},"erp_code":{"type":"string"},"description":{"type":"string"}},"required":["name","code","type","status"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationId","required":true}],"responses":{"200":{"description":"Default Response"}}}}}}
```

## GET /locations/{siteId}/export-csv

> Export all locations for a site as CSV using the same columns as import (type is location type id).

```json
{"openapi":"3.0.3","info":{"title":"Incident Tracker API","version":"1.0.0"},"servers":[{"url":"https://api.kitehouse.co.uk"}],"paths":{"/locations/{siteId}/export-csv":{"get":{"tags":["Locations"],"description":"Export all locations for a site as CSV using the same columns as import (type is location type id).","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}}}}
```

## POST /locations/{site}/import

> Import a list of locations.

```json
{"openapi":"3.0.3","info":{"title":"Incident Tracker API","version":"1.0.0"},"servers":[{"url":"https://api.kitehouse.co.uk"}],"paths":{"/locations/{site}/import":{"post":{"tags":["Locations"],"description":"Import a list of locations.","parameters":[{"schema":{"type":"string"},"in":"path","name":"site","required":true}],"responses":{"200":{"description":"Default Response"}}}}}}
```
