# router state samples — NCM API

Online/offline connection history for each device, one sample per state change. Read-only, a single list call, and the endpoint behind uptime reporting. It is also the polling pattern webhooks replace: subscribe to router state change events if you only need to react.

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

### GET /router_state_samples/

Get information about router_state_samples

<p>Use the GET method on this endpoint to retrieve router_state_samples records. Use the available filtering fields to narrow or broaden your search. This endpoint provides information about the connection state of a device with NetCloud servers.</p><p><strong>Note:</strong> There is a 100 device limit for API queries. If you attempt to retrieve records for more than 100 devices in a single query you will receive an error message. If you do not explicitly specify devices, it is assumed that you are trying to pull records for all devices in your account. If you have more than 100 devices in your account then you may query in batches. See the example titled 'Net Device Usage and Signal Samples' on the Sample Code page for details on querying net_device_signal_samples in batches.</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> |
| router | query | in: int<br />out: url | no | Router ID |
| router__in | query | in: int<br />out: url | no | Filter for router ID contains - a comma-separated list of router-record IDs |
| created_at | query | timestamp | no | Timestamp for when the router_state_samples record was created |
| created_at__lt | query | timestamp | no | Less than filtering operator for created_at |
| created_at__gt | query | timestamp | no | Filter for created_at is greater than |
| created_at_timeuuid | query | timeuuid | no | A unique ID (timeuuid) associated with the created_at timestamp |
| created_at_timeuuid__in | query | timeuuid | no | Filter for created_at_timeuuid in - a comma-separated list of timeuuids for router_state_samples records |
| created_at_timeuuid__gt | query | timeuuid | no | Filter for created_at_timeuuid is greater than |
| created_at_timeuuid__gte | query | timeuuid | no | Filter for created_at_timeuuid is greater than or equal to |
| created_at_timeuuid__lt | query | timeuuid | no | Filter for created_at_timeuuid is less than |
| created_at_timeuuid__lte | query | timeuuid | no | Filter for created_at_timeuuid is less than or equal |
| order_by | query | string | no | Specifies the sort order for response data |
| 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/router_state_samples/" \
  -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": [
    {
      "created_at": "2020-11-29T13:08:17.143272+00:00",
      "created_at_timeuuid": "f221d310-3243-11eb-827b-daedcb174526",
      "period": 188.75138449668884,
      "router": "https://www.cradlepointecm.com/api/v2/routers/2162719/",
      "state": "offline"
    }
  ],
  "meta": {
    "limit": 20,
    "next": null
  }
}
```
