Skip to content

Base Data

Overview

The base endpoints deliver reference data required to configure factors and modules. Responses are cached briefly on the server so they can be reused across projects.

Endpoint Summary

MethodPathDescriptionNotes
GET/api/v2/base/factor-options/Enumerations for factor creation (data type, Modbus type, endian)See Factor Options.
GET/api/v2/base/device-types/Public device type catalog exposed to SaaS tenantsSee Device Types.
GET/api/v2/base/module-list/Available hardware modules (name, model, description, image)See Module List.

Factor Options

http
GET /api/v2/base/factor-options/
Authorization: Bearer <token>

Response:

json
{
  "data_type_choices": [
    ["INT16", "16-bit Integer"],
    ["UINT16", "16-bit Unsigned Integer"],
    ["INT32", "32-bit Integer"],
    ["UINT32", "32-bit Unsigned Integer"],
    ["FLOAT", "Single Precision Float"]
  ],
  "modbus_type_choices": [
    ["INPUT_REGISTER", "Input Register"],
    ["HOLDING_REGISTER", "Holding Register"],
    ["DISCRETE_INPUT", "Discrete Input"],
    ["COIL", "Coil"]
  ],
  "data_endian_choices": [
    ["ABCD", "Big Endian (ABCD)"],
    ["DCBA", "Little Endian (DCBA)"],
    ["BADC", "Big Endian Byte Swap"],
    ["CDAB", "Little Endian Byte Swap"]
  ]
}

Use these enumerations when building factor creation forms. The service removes placeholder values (e.g., NONE) so every option is valid for production devices.

Device Types

http
GET /api/v2/base/device-types/
Authorization: Bearer <token>

Returns the subset of DeviceTypeConfig objects marked open_to_saas=true:

json
[
  {
    "the_type": "temp",
    "name": "Temperature",
    "unit": "℃",
    "icon": "https://cloud.yanjiiot.com/media/icon/temp.png"
  },
  {
    "the_type": "humi",
    "name": "Humidity",
    "unit": "%RH",
    "icon": "https://cloud.yanjiiot.com/media/icon/humi.png"
  }
]
  • the_type: Identifier used by factors (the_type field)
  • unit: Engineering unit to display on dashboards
  • icon: Optional OSS URL (empty string when undefined)

Module List

http
GET /api/v2/base/module-list/
Authorization: Bearer <token>

Provides metadata for hardware expansion modules. Typical response:

json
[
  {
    "pk": 10,
    "name": "Y301-440",
    "model": "Y301-440",
    "info": "4DI/4DO IO module",
    "image": "https://cdn.yanjiiot.com/modules/y301-440.png"
  }
]

Use this endpoint to populate module pickers when importing factor templates via /devices/{device_pk}/add-module/.

Operational Notes

  1. Caching: Factor options cache for 1 hour; device types and module list cache for 10 minutes. Clients should cache locally and refresh only when users revisit configuration flows.
  2. Localization: Names and units are stored in their canonical form (Chinese or English). UI layers can localize labels if needed.
  3. Icon Hosting: Icons usually point to OSS; fall back to device-type default imagery when the field is blank.