# Device Management API-V1

## gateway list

<mark style="color:blue;">`GET`</mark> `{host}/1.0/lists/gateway`

get the list of gateways

#### Query Parameters

| Name   | Type   | Description                                    |
| ------ | ------ | ---------------------------------------------- |
| offset | number | current page number, start from 1, default = 1 |
| length | string | the number of rows in page, default = 20       |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "code": "0",
    "data": {
        "page": {
            "count": "8"
        },
        "list": [
            {
                "dev_eui": "2CF7F11113500001",
                "dev_name": "2CF7F11113500001_gateway",
                "org_id": "1411841915123",
                "position_source": "1",
                "dev_country": "",
                "frequency": "920",
                "device_network": "1",
                "position": {
                    "lon": "113.926979",
                    "lat": "22.573724"
                },
                "description": "",
                "reg_time": "1567041885000",
                "bind_time": "1571208951000",
                "latestmsg_time": "0",
                "online_status": "0"
            }
        ]
    }
}

```

{% endtab %}
{% endtabs %}

> Example request
>
> ```bash
> curl --request GET \
>      --url {host}/1.0/lists/gateway?offset=1&length=2 \
>      --user '<username>:<password>'
> ```

## get gateway detail

<mark style="color:blue;">`GET`</mark> `{host}/1.0/gateway/:gateway_eui`

get the detail of a specific gateway

#### Path Parameters

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| gateway\_eui | string | device EUI  |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "code": "0",
    "data": { 
        "frequency": "470",  // frequency
        "dev_eui": "2CF7F11213200000", // gateway EUI, equipment unique identity
        "dev_name": "2CF7F11014300001", // gateway name
        "dev_country": "China",  // name country, defined by customer
        "device_network": "1",
        "description": "a gateway for test", // desc something
        "position": {                        // geographic
            "lon": "113.926979",
            "lat": "22.573724"
        },
        "position_source": "0",
        "reg_time": "1565313100000", // when the customer activates the device, unit milliseconds
        "bind_time": "0",   // the gateway bind time, unit milliseconds
        "dev_area": "Asia", // gateway area, Europe America Asia
        "latestmsg_time": "0",  // the latest message time, unit milliseconds
        "online_status": "0"    // 1 online, 0 offline
    }
}
```

{% endtab %}
{% endtabs %}

> Example request
>
> ```bash
> curl --request GET \
>      --url {host}/1.0/gateway/:gateway_eui \
>      --user '<username>:<password>'
> ```

## node list

<mark style="color:blue;">`GET`</mark> `{host}/1.0/lists/node`

get the list of Node devices

#### Query Parameters

| Name   | Type   | Description                                    |
| ------ | ------ | ---------------------------------------------- |
| length | string | the number of rows in page, default = 20       |
| offset | string | current page number, start from 1, default = 1 |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "code": "0",
    "data": {
        "page": {
            "count": "84"  // total number 
        }, 
        "list": [
            {
                "dev_eui": "2CF7F1201350001A", // node EUI, equipment unique identity
                "dev_name": "2CF7F1201350001A", // node name
                "org_id": "1411841915123",
                "position_source": "0",
                "dev_country": "American Samoa", // name country, defined by customer
                "frequency": "868",    // frequency
                "device_network": "1",
                "description": "21111", // desc something
                "reg_time": "1567041874000",
                "bind_time": "1571209669000",
                "group_unique_name": "00452831720DCA8A",
                "position": {
                    "lat": "26.15868",
                    "lon": "111.304984"
                },
                "latestmsg_time": "0", // the latest message time, unit milliseconds
                "online_status": "0", // 1 online, 0 offline
                "battery_status": "1", // 1 node battery for good, 0 node battery for bad
                "group_name": "22"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

> Example request
>
> ```bash
> curl --request GET \
>      --url {host}/1.0/lists/node?offset=1&length=2 \
>      --user '<username>:<password>'
> ```

## get node detail&#x20;

<mark style="color:blue;">`GET`</mark> `{host}/1.0/node/:node_eui`

get the detail of a specific node

#### Path Parameters

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| node\_eui | string | device EUI  |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "code": "0",
    "data": {
        "frequency": "AS470-510",
        "dev_eui": "2CF7F16221200060",
        "dev_name": "2CF7F12010700002",
        "dev_country": "",
        "description": "",
        "reg_time": "1584528155000",
        "dev_area": "Asia",
        "latestmsg_time": "1587366392944",
        "online_status": "0",
        "battery_status": "1",
        "group_name": "",
        "activate_time": "0",
        "sensors": [
            {
                "sensor_eui": "0111006221200060",
                "sensor_channel": "11",
                "sensor_type": "2001",
                "sensor_measure": [
                    {
                        "id": "4097"
                    }
                ]
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

> Example request
>
> ```bash
> curl --request GET \
>      --url {host}/1.0/node/:node_eui \
>      --user '<username>:<password>'
> ```

## sensor measure list

<mark style="color:blue;">`GET`</mark> `{host}/1.0/lists/sensor/measure`

get the list of all physical measurements of all sensor types. also see Appendix - List of Sensor Types.

{% tabs %}
{% tab title="200 usually one sensor has one measurement, but some sensors contain two or three measurements.
" %}

```javascript
{
    "code": "0",
    "data": [
        {
            "sensor_id": "1009",
            "sensor_name": "Wind Speed",
            "sensor_measure": [
                {
                    "measure_id": "4112",
                    "measure_name": "Wind Direction",
                    "measure_unit": "°"
                },
                {
                    "measure_id": "4105",
                    "measure_name": "Wind Speed",
                    "measure_unit": "m/s"
                }
            ]
        },
        {
            "sensor_id": "1008",
            "sensor_name": "Wind Direction",
            "sensor_measure": [
                {
                    "measure_id": "4104",
                    "measure_name": "Wind Direction",
                    "measure_unit": "°"
                }
            ]
        },
        {
            "sensor_id": "1006",
            "sensor_name": "Soil temperature and humidity",
            "sensor_measure": [
                {
                    "measure_id": "4103",
                    "measure_name": "Soil Humidity",
                    "measure_unit": "%RH"
                },
                {
                    "measure_id": "4102",
                    "measure_name": "Soil Temperature",
                    "measure_unit": "°C"
                }
            ]
        },
        {
            "sensor_id": "1005",
            "sensor_name": "Atmospheric Pressure",
            "sensor_measure": [
                {
                    "measure_id": "4101",
                    "measure_name": "Atmospheric Pressure",
                    "measure_unit": "Pa"
                }
            ]
        },
        {
            "sensor_id": "1004",
            "sensor_name": "Carbon Dioxide",
            "sensor_measure": [
                {
                    "measure_id": "4100",
                    "measure_name": "Carbon Dioxide",
                    "measure_unit": "Vol"
                }
            ]
        },
        {
            "sensor_id": "1003",
            "sensor_name": "Light Intensity",
            "sensor_measure": [
                {
                    "measure_id": "4099",
                    "measure_name": "Light Intensity",
                    "measure_unit": "Lux"
                }
            ]
        },
        {
            "sensor_id": "1001",
            "sensor_name": "Air Temperature and Humidity",
            "sensor_measure": [
                {
                    "measure_id": "4098",
                    "measure_name": "Air Humidity",
                    "measure_unit": "%RH"
                },
                {
                    "measure_id": "4097",
                    "measure_name": "Air Temperature",
                    "measure_unit": "℃"
                }
            ]
        }
    ],
    "time": 1.958
}
```

{% endtab %}
{% endtabs %}

> Example request
>
> ```bash
> curl --request GET \
>      --url {host}/1.0/lists/sensor/measure \
>      --user '<username>:<password>' \
> ```

## check device eui and code

<mark style="color:green;">`POST`</mark> `{host}/1.0/device/check_eui`

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| code | string | device code |
| eui  | string | device eui  |

{% tabs %}
{% tab title="200 " %}

```
{
    "code": "0",
    "data": {
        "check": "1"  // 0-check fail,1-check success
    },
    "time": 0.261
}
```

{% endtab %}
{% endtabs %}

> Example request

> > ```bash
> > curl --request POST \
> >      --url '{host}/1.0/device/check_eui' \
> >      --user '<username>:<password>' \
> >      --header 'content-type: application/x-www-form-urlencoded' \
> >      --data '{"code":"device code","eui":"device eui"}' \
> >      --include
> > ```

## bind device

<mark style="color:green;">`POST`</mark> `{host} /1.0/device/bind`

bind device to account

#### Request Body

| Name                | Type   | Description                                                  |
| ------------------- | ------ | ------------------------------------------------------------ |
| eui                 | string | device eui                                                   |
| code                | string | device code                                                  |
| device\_name        | string | device name                                                  |
| group\_uinque\_name | string | group unique name,available through the group list interface |
| lon                 | string | device positon, longitude                                    |
| lat                 | string | device postion,latitude                                      |

{% tabs %}
{% tab title="200 " %}

```
{
    "code": "0",
    "data": {},
    "time": 0.261
}
```

{% endtab %}
{% endtabs %}

> Example request

```bash
curl --request POST \
     --url '{host}/1.0/device/check_eui' \
     --user '<username>:<password>' \
     --header 'content-type: application/x-www-form-urlencoded' \
     --data '{"code":"device code","eui":"device eui"}' \
     --include
```


---

# 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://sensecap.gitbook.io/doc/http-api/overview/devices-operation.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.
