# locations — NCM API

The current reported position of each device, including coordinates and the time the fix was taken. Full lifecycle: list, create, update and delete location records. For where a device has been rather than where it is now, see historical locations.

Base URL: https://www.cradlepointecm.com/api/v2

### GET /locations/

Get information about locations

Use the GET method on this endpoint to retrieve locations records. Use the available filtering fields to narrow or broaden your search.

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |
| id | query | integer | no | ID of a locations record |
| id__in | query | integer | no | Filter for ID contains - a comma-separated list of locations record IDs |
| limit | query | integer | no | Restricts the number of records returned in a recordset to this value. Max value is 500. |
| offset | query | integer | no | Specifies where (an index) in a recordset to begin returning records. |

**Example request**

```bash
curl "https://www.cradlepointecm.com/api/v2/locations/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>"
```

**Response 200** — Example response.

```json
{
  "data": [
    {
      "account": "https://www.cradlepointecm.com/api/v2/accounts/<account number>/",
      "accuracy": 0,
      "id": "731218",
      "latitude": 43.5783243,
      "longitude": -116.1913274,
      "method": "manual",
      "resource_url": "https://www.cradlepointecm.com/api/v2/locations/731218/",
      "router": "<router id>",
      "updated_at": "2021-01-25T16:04:34.731183+00:00"
    }
  ],
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null
  }
}
```

### POST /locations/

Create a locations record

<p>This operation creates a Location.</p>

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |

**Request body**

**Example request**

```bash
curl -X POST "https://www.cradlepointecm.com/api/v2/locations/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>" \
  -H "Content-Type: application/json" \
  -d '{ ... }'
```

**Response 200** — Example response.

```json
{
  "account": "https://www.cradlepointecm.com/api/v2/accounts/<account number>/",
  "accuracy": 0,
  "id": "763427",
  "latitude": 54.6197012,
  "longitude": -116.2059159,
  "method": "manual",
  "resource_url": "https://www.cradlepointecm.com/api/v2/locations/",
  "router": "<router id>",
  "updated_at": "2021-02-17T17:36:53.239075+00:00"
}
```

### PUT /locations/{id}/

Update a locations record

<p>This operation updates Locations.</p>

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |
| id | path | integer | yes | ID of the locations record to update |

**Request body**

**Example request**

```bash
curl -X PUT "https://www.cradlepointecm.com/api/v2/locations/{id}/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>" \
  -H "Content-Type: application/json" \
  -d '{ ... }'
```

**Response 200** — Example response.

```json
{
  "account": "https://www.cradlepointecm.com/api/v2/accounts/<account number>/",
  "accuracy": 0,
  "id": "731218",
  "latitude": 44.6197012,
  "longitude": -116.2059159,
  "method": "manual",
  "resource_url": "https://www.cradlepointecm.com/api/v2/locations/731218/",
  "router": "<router id>",
  "updated_at": "2021-02-17T16:51:50.499149+00:00"
}
```

### DELETE /locations/{id}/

Delete a locations record

Use the DELETE method on this endpoint to delete a locations record. This method requires the ID of the locations record to delete. Performing a DELETE action removes the record from NetCloud and can't be reversed.

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |
| id | path | integer | yes | ID of the locations record to delete |

**Example request**

```bash
curl -X DELETE "https://www.cradlepointecm.com/api/v2/locations/{id}/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>"
```

**Response 200** — No response was specified
