iotapi

IoT platform management toolkit: manage devices, products, alarms, thing models, and device communication. Use this when users need to interact with IoT devices, query device status, set device properties, call device services, manage IoT products, or handle IoT alarms.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "iotapi" with this command: npx skills add beare/skills/beare-skills-iotapi

iotapi — IoT Platform Management Toolkit


Setup

If iotapi MCP tools are already available, no setup is needed — just use them.

Otherwise, the user needs to configure their IoT platform connection. Direct them to set up credentials using one of these methods:

Method 1: Using Token (Recommended for Quick Start)

If the user already has a token from the web UI:

mkdir -p ~/.config/iotapi && cat > ~/.config/iotapi/credentials.json << 'EOF'
{
  "base_url": "https://iot.iwillcloud.com",
  "token": "YOUR_TOKEN_HERE"
}
EOF

Method 2: Using AppKey/AppSecret (Auto-refresh)

For long-term use with automatic token refresh:

mkdir -p ~/.config/iotapi && cat > ~/.config/iotapi/credentials.json << 'EOF'
{
  "base_url": "https://iot.iwillcloud.com",
  "app_key": "YOUR_APP_KEY",
  "app_secret": "YOUR_APP_SECRET"
}
EOF

Method 3: Environment Variables

export IOTAPI_BASE_URL="https://iot.iwillcloud.com"
export IOTAPI_TOKEN="your_token_here"
# OR
export IOTAPI_APP_KEY="your_app_key"
export IOTAPI_APP_SECRET="your_app_secret"

When to Trigger This Setup

  • User asks to interact with IoT devices but no iotapi MCP tools are available and no credentials configured
  • Any API call fails with 401 authentication error
  • User mentions their IoT platform URL or wants to connect to their IoT system

Direct API Mode

When MCP tools are NOT available, call the API directly using curl via Bash.

Getting Credentials

Read in order, use the first one found:

  1. Environment variables: IOTAPI_BASE_URL, IOTAPI_TOKEN (or IOTAPI_APP_KEY + IOTAPI_APP_SECRET)
  2. Config file: ~/.config/iotapi/credentials.json (macOS/Linux) or %APPDATA%\iotapi\credentials.json (Windows)
    {
      "base_url": "https://iot.iwillcloud.com",
      "token": "...",
      "app_key": "...",
      "app_secret": "..."
    }
    
  3. If neither exists, direct the user to configure credentials. Do NOT ask the user to paste credentials in chat.

Getting a Token

If only app_key and app_secret are available, obtain a token first:

curl -X POST "${IOTAPI_BASE_URL}/api/v1/oauth/auth" \
  -H "Content-Type: application/json" \
  -d '{
    "appKey": "'"${IOTAPI_APP_KEY}"'",
    "appSecret": "'"${IOTAPI_APP_SECRET}"'"
  }'

Response:

{
  "code": 200,
  "success": true,
  "data": "77e7368a-fe49-4bb7-8755-50756ebf26f4",
  "errorMessage": ""
}

Extract the token from data field and use it in subsequent requests.

API Call Pattern

Important: This platform uses a custom token header, NOT the standard Authorization: Bearer format.

curl -X POST "${IOTAPI_BASE_URL}/api/v1/{endpoint}" \
  -H "Content-Type: application/json" \
  -H "token: ${IOTAPI_TOKEN}" \
  -d '{
    "param1": "value1",
    "param2": "value2"
  }'

All requests are POST with JSON body. Responses follow this format:

{
  "code": 200,
  "success": true,
  "data": { ... },
  "errorMessage": ""
}
  • code: 200 = success, other values indicate errors
  • success: boolean indicating if request succeeded
  • data: response payload (structure varies by endpoint)
  • errorMessage: error description (empty on success)

API Endpoints

Authentication

Get Token

Endpoint: POST /api/v1/oauth/auth

Parameters:

{
  "appKey": "string",
  "appSecret": "string"
}

Response: Token string in data field (valid for 24 hours)


Alarm APIs

Query Alarm List

Endpoint: POST /api/v1/alarm/queryAlarmListAll

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
startTimestringNoStart time (ISO 8601 or timestamp)
endTimestringNoEnd time (ISO 8601 or timestamp)
statusstringNoAlarm status: Trigger, ManualRelieve, AutoRelieve

Response: Array of alarm objects with fields:

  • name: Alarm name
  • category: Category (e.g., "Point")
  • level: Level (e.g., "Level1")
  • generateValue: Trigger value
  • restoreValue: Restore value
  • restoreTime: Restore timestamp
  • status: Current status
  • device: Device object
  • createTime: Creation timestamp

Product APIs

Create Product

Endpoint: POST /api/v1/product/create

Parameters:

ParameterTypeRequiredDescription
productNamestringYesProduct name
productKeystringNoProduct key (auto-generated if not provided)
authTypestringNoAuth type: Default, Once, Dynamic (default: Default)
productSecretstringNoProduct secret (required for Dynamic auth, auto-generated otherwise)

Query Product Details

Endpoint: POST /api/v1/product/query

Parameters: Provide one of:

  • productKey: Product key
  • productId: Product ID

Query All Products

Endpoint: POST /api/v1/product/queryListAll

Parameters:

ParameterTypeRequiredDescription
productNamestringNoProduct name (supports fuzzy search)

Response: Array of products with fields:

  • productKey: Product identifier
  • productName: Product name
  • authType: Authentication type
  • productSecret: Product secret
  • deviceNumber: Number of devices
  • propertyNumber: Number of properties
  • eventNumber: Number of events
  • serviceNumber: Number of services

Delete Product

Endpoint: POST /api/v1/product/delete

Parameters: Provide one of:

  • productKey: Product key
  • productId: Product ID

Device APIs

Quick Register Device

Endpoint: POST /api/v1/quickdevice/register

Parameters:

ParameterTypeRequiredDescription
productKeystringYesProduct key
deviceNamestringNoDevice code (auto-generated if not provided)
nickNamestringNoDevice nickname (defaults to deviceName)

Query Device Details

Endpoint: POST /api/v1/quickdevice/detail

Parameters: Provide one of:

  • deviceName: Device code
  • deviceId: Device ID

Response: Device object with fields:

  • deviceId: Device unique ID
  • deviceName: Device code
  • nickName: Device nickname
  • productKey: Product key
  • productName: Product name
  • deviceSecret: Device secret
  • status: Device status (ONLINE, OFFLINE, UNACTIVE)
  • ipAddress: IP address
  • activeTime: Activation timestamp
  • onlineTime: Last online timestamp
  • createTime: Creation timestamp
  • firmwareVersion: Firmware version (if reported)

Query Device Status

Endpoint: POST /api/v1/quickdevice/status

Parameters: Provide one of:

  • deviceName: Device code
  • deviceId: Device ID

Response: Status string (ONLINE, OFFLINE, UNACTIVE)

Batch Query Device State

Endpoint: POST /api/v1/quickdevice/batchGetDeviceState

Parameters: Provide one of (max 100 devices):

  • deviceName: Array of device codes
  • deviceId: Array of device IDs

Response: Array of device state objects

Batch Query Device Details

Endpoint: POST /api/v1/quickdevice/batchQueryDeviceDetail

Parameters:

ParameterTypeRequiredDescription
productKeystringYesProduct key
deviceNamearrayNoDevice codes (returns all if not provided)

Query Devices by Product

Endpoint: POST /api/v1/quickdevice/queryDevice

Parameters:

ParameterTypeRequiredDescription
productKeystringYesProduct key

Response: Array of all devices under the product


Thing Model APIs

Query Thing Model

Endpoint: POST /api/v1/thing/queryThingModel

Parameters:

ParameterTypeRequiredDescription
productKeystringYesProduct key

Response: Thing model definition with properties, events, and services

Set Device Property

Endpoint: POST /api/v1/thing/setDevicesProperty

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
pointListarrayYesArray of property objects: [{"identifier": "prop1", "value": "val1"}]

Batch Set Device Properties

Endpoint: POST /api/v1/thing/setBatchDevicesProperty

Parameters:

ParameterTypeRequiredDescription
deviceNamearrayYesArray of device codes
pointListarrayYesArray of property objects

Invoke Device Service

Endpoint: POST /api/v1/thing/invokeThingsService

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
servicePointobjectYesService info: {"identifier": "service_name"}
pointListarrayYesService input parameters: [{"identifier": "param1", "value": "val1"}]

Batch Invoke Device Service

Endpoint: POST /api/v1/thing/invokeBatchThingsService

Parameters:

ParameterTypeRequiredDescription
deviceNamearrayYesArray of device codes
servicePointobjectYesService info
pointListarrayYesService input parameters

Query Device Property Data

Endpoint: POST /api/v1/thing/queryDevicePropertyData

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
identifierstringYesProperty identifier
startTimestringYesStart time
endTimestringYesEnd time
downSamplingstringNoDown-sampling interval (default: "1s")

Batch Query Device Properties Data

Endpoint: POST /api/v1/thing/queryDevicePropertiesData

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
identifierstringYesComma-separated property identifiers
startTimestringYesStart time
endTimestringYesEnd time
downSamplingstringNoDown-sampling interval (default: "1s")

Query Device Event Data

Endpoint: POST /api/v1/thing/queryDeviceEventData

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
identifierstringNoEvent identifier (all events if not provided)
startTimestringYesStart time
endTimestringYesEnd time

Query Device Service Data

Endpoint: POST /api/v1/thing/queryDeviceServiceData

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
identifierstringNoService identifier (all services if not provided)
startTimestringYesStart time
endTimestringYesEnd time

Response: Array of service call records with fields:

  • send: Sent content
  • receive: Response content
  • receiveTime: Response timestamp
  • result: Result
  • resultTime: Result timestamp
  • servicePoint: Service point info

Custom Topic APIs

For devices that don't use thing model, the platform supports custom topics for transparent message passing.

Topics:

  • Subscribe (device receives): /{productKey}/{deviceName}/user/get
  • Publish (device sends): /{productKey}/{deviceName}/user/update
  • Error: /{productKey}/{deviceName}/user/update/error

Send Custom Message to Device

Endpoint: POST /api/v1/device/down/record/add/custom

Parameters:

ParameterTypeRequiredDescription
deviceNamestringYesDevice code
messageContentstringYesBase64-encoded message content

Example: To send binary Modbus command 01 03 00 00 00 01 84 0A:

# Convert to Base64: AQMAAAABhAo=
curl -X POST "${IOTAPI_BASE_URL}/api/v1/device/down/record/add/custom" \
  -H "Content-Type: application/json" \
  -H "token: ${IOTAPI_TOKEN}" \
  -d '{
    "deviceName": "Wk9kOa5NLX",
    "messageContent": "AQMAAAABhAo="
  }'

RRPC (Synchronous MQTT Communication)

RRPC enables synchronous request-response communication with devices over MQTT.

Device subscribes to: /sys/${productKey}/${deviceName}/rrpc/request/+ Device responds to: /sys/${productKey}/${deviceName}/rrpc/response/${requestId}

Send RRPC Request

Endpoint: POST /api/v1/device/rrpc

Parameters:

ParameterTypeRequiredDescription
productKeystringYesProduct key
deviceNamestringYesDevice code
requestBase64BytestringYesBase64-encoded request message
timeoutlongYesTimeout in milliseconds

Response:

{
  "code": 200,
  "success": true,
  "data": {
    "rrpcCode": "SUCCESS",  // or "TIMEOUT", "OFFLINE"
    "payloadBase64Byte": "base64_encoded_response"
  }
}

RRPC Codes:

  • SUCCESS: Device responded successfully
  • TIMEOUT: No response within timeout period
  • OFFLINE: Device is offline

Note: Platform automatically handles Base64 encoding/decoding. Device receives raw bytes and should respond with raw bytes.


Error Handling

ErrorSolution
401Invalid or expired token — obtain new token via /api/v1/oauth/auth
403Insufficient permissions — check appKey permissions configuration
Connection refusedVerify IOTAPI_BASE_URL is correct and platform is accessible
code != 200Check errorMessage field in response for details

Best Practices

Workflow Patterns

1. Device Management Flow:

Query products → Select product → Query devices → Get device details/status

2. Device Control Flow:

Query thing model → Identify properties/services → Set property or invoke service

3. Data Query Flow:

Get device list → Query property/event/service data for time range

Performance Tips

  • Use batch APIs when operating on multiple devices (max 100 per request)
  • Query thing model once and cache the structure
  • Use parallel requests for independent operations
  • For real-time control, prefer RRPC over async property setting
  • Use custom topics for devices with proprietary protocols

Common Patterns

Check device online status before control:

# 1. Check status
curl -X POST "${IOTAPI_BASE_URL}/api/v1/quickdevice/status" \
  -H "Content-Type: application/json" \
  -H "token: ${IOTAPI_TOKEN}" \
  -d '{"deviceName": "sensor_001"}'

# 2. If online, set property
curl -X POST "${IOTAPI_BASE_URL}/api/v1/thing/setDevicesProperty" \
  -H "Content-Type: application/json" \
  -H "token: ${IOTAPI_TOKEN}" \
  -d '{
    "deviceName": "sensor_001",
    "pointList": [{"identifier": "temperature_threshold", "value": "25"}]
  }'

Query historical data with time range:

curl -X POST "${IOTAPI_BASE_URL}/api/v1/thing/queryDevicePropertyData" \
  -H "Content-Type: application/json" \
  -H "token: ${IOTAPI_TOKEN}" \
  -d '{
    "deviceName": "sensor_001",
    "identifier": "temperature",
    "startTime": "2025-01-01T00:00:00.000Z",
    "endTime": "2025-01-31T23:59:59.999Z",
    "downSampling": "1h"
  }'

Data Limitations

LimitationMitigation
Token expires after 24 hoursStore appKey/appSecret for auto-refresh, or regenerate token
Batch operations limited to 100 devicesSplit large operations into multiple requests
Property/event data queries return paginated resultsUse appropriate time ranges and down-sampling
RRPC timeout is user-definedSet reasonable timeout based on device response time (typically 5-10 seconds)
Custom topic messages must be Base64 encodedUse base64 command or programming language libraries

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

Repository SourceNeeds Review
94.2K159.5K
anthropics
Coding

remotion-best-practices

Use this skills whenever you are dealing with Remotion code to obtain the domain-specific knowledge.

Repository SourceNeeds Review
2.1K147.4K
remotion-dev
Coding

azure-ai

Service Use When MCP Tools CLI

Repository SourceNeeds Review
155135.8K
microsoft