English
Micro-application Data and Resources
Application parameter ownership
Following “everything is a device”, presentation settings, layouts, component settings, 3D settings and other application parameters belong to the corresponding device's app_attrs. ThinkLink is the authority for reads and writes. Project, building and space settings belong to the device representing that object. Shared settings need one explicit owner device; consumers reference it instead of saving competing copies.
Browser storage is a temporary cache. Reloading, signing in again or switching browsers must recover the platform value. Keep device identity not ready, association not ready, load failure and missing data distinct. Never save an empty object because identity or data has not loaded.
| Content | Owner and write boundary |
|---|---|
| Application and component settings | Device app_attrs; register owned top-level fields, nested schema, schema version and writer |
| Shared project or space settings | Device representing the object; record its device ID/EUI mapping rather than using a business object ID as a device ID |
| 3D configuration | app_attrs.__transform_3d; the application defines models, coordinates, units and rendering |
| Operation logs, maintenance logs and their attachments | Independent platform log services; never app_attrs or a project log array |
Reading and partial updates
Use platform device data APIs to read all app_attrs or select top-level fields. Read the owning top-level field when nested data is needed. Do not request 3D as a top-level transform_3d field.
- Prefer
POST /thinklink/device/update-device-datawith the owner device’seuiandtype: "app_attrs"; useset,set_pathsandremovefor the intended fields while preserving other applications and components. - When changing device configuration and application attributes together, use
update-configwithattribute_changes.app_attrs. Submit only owned, changed fields; do not write back the entire snapshot. - Prefer
set_pathsfor nested updates. Replacing a shared top-level object from an old snapshot can overwrite another component. Partial updates do not automatically resolve concurrent edits to the same field. - Thing-model and RPC attribute updates remain top-level shallow merges. Preserve sibling properties explicitly when changing a nested object; HTTP
set_pathssemantics do not apply to scripts. - Read back after saving. Application attributes participate in forwarding only when forwarding fields are explicitly configured. Do not assume every change is pushed over MQTT; refresh by querying when no reliable subscription exists.
The following is application data, not a mandated platform schema or a complete HTTP request. Separate components own overview and equipmentCard; the 3D field uses the platform name:
json
{
"overview": {"schemaVersion": 1, "layout": "grid"},
"equipmentCard": {"schemaVersion": 1, "showHumidity": true},
"__transform_3d": {"position": {"x": 1, "y": 2, "z": 3}}
}Use modifyAttrs when migrating scripts. To change only x, preserve other 3D properties and position y/z. This example constructs a value only; currentAppAttrs must be successfully read from ThinkLink. It is not an RPC action envelope or an atomic concurrency mechanism:
javascript
const current3d = currentAppAttrs.__transform_3d ?? {};
const next3d = {
...current3d,
position: { ...current3d.position, x: 4 }
};
const ownedPatch = { __transform_3d: next3d };
// Submit using the target version's modifyAttrs contract, then read back.Verified APIs and request examples
Use the business platform origin <BASE_URL> without /thinklink, with the token: <TOKEN> header. The MCP URL is not the business API base. JSON requests use Content-Type: application/json.
| Method and path | operationId | Request and response |
|---|---|---|
| POST /thinklink/device/find-device-data | deviceFindDeviceData | Required id/type; app_attrs returns full {content}, empty content is {}, no group update_time |
| POST /thinklink/device/find-current-attrs | deviceFindCurrentAttrs | Locate by id; preserve existing read parameters, not eui |
| POST /thinklink/device/find-page-by-fields | deviceFindPageByFields | app_attrs:true or a top-level field array; returns data/total/current/pageSize, total may be a decimal string |
| POST /thinklink/device/update-device-data | deviceUpdateDeviceData | Required eui/type; id is rejected; partial updates return the complete committed {content} snapshot |
| POST /thinklink/device/update-config | deviceUpdateConfig | Required id; changes for configuration, attribute_changes.app_attrs for application patches; returns {result:true} |
Full-group request body:
json
{"id":"<DEVICE_ID>","type":"app_attrs"}Projected page request scoped to actual device bindings (exact EUI matching; an empty binding must produce an empty scope):
json
{"current":1,"pageSize":50,"euis":["<DEVICE_EUI>"],"fields":["id","name"],"app_attrs":["cockpit","__transform_3d"]}Do not put app_attrs in fields. Dots are literal key characters, not nested paths. Missing keys are omitted; explicit null/false/0 and nested null remain. Full-group reads use current memory; paginated reads use database snapshots that may lag and have no cross-page consistency guarantee.
Partial update, only for owned fields whose existing parents are objects or absent:
sh
curl -X POST '<BASE_URL>/thinklink/device/update-device-data' \
-H 'token: <TOKEN>' -H 'Content-Type: application/json' \
--data '{"eui":"<DEVICE_EUI>","type":"app_attrs","set_paths":[{"path":["cockpit","layout","columns"],"value":3}],"remove":[["cockpit","obsolete"]]}'set replaces whole top-level values. set_paths is an array of {path:["parent","child"],value:...} entries with at least one nonempty string per path; missing parent objects are created. Arrays are replaced atomically, not indexed. In remove, strings delete top-level keys and string arrays delete object paths. Missing paths do nothing and empty parents remain. Duplicate or ancestor/descendant paths, traversal through scalars/null/arrays, unknown patch fields and invalid JSON are rejected. null/false/0 are values, not deletion commands.
Combined configuration and attribute request, after reading and confirming the intended changes:
json
{"id":"<DEVICE_ID>","changes":{"name":"<DEVICE_NAME>"},"attribute_changes":{"app_attrs":{"set_paths":[{"path":["cockpit","layout","columns"],"value":3}]}}}Read back the device configuration after a save or a timeout. Verify any changes before retrying. Single-device and batch operations use separate request formats.
Management HTTP saves do not publish attribute MQTT. Explicit forwarding fields are necessary for application attributes to participate in forwarding, but do not make HTTP saves push messages. Verify script events and natural device cycles separately.
2026-10-20: EUI save protocol
Only update-device-data changes to eui, locating the device by the current token's organization and EUI. The EUI is trimmed and lowercased. An ID-only request, or a request containing both eui and id, returns 400 and is incompatible.
find-device-data, find-current-attrs and update-config still use id. Maintain an accurate ID/EUI association for the owner device. Do not replace IDs globally or blindly retry with a different identity field after an error.
Save results and error handling
After saving, read the attribute group using the associated device ID and check the changed fields. If several users edit the same field, use a fresh reading. Keep your edits after a validation error and correct the patch. After a timeout or disconnection, check the target fields before retrying.
sh
curl -X POST '<BASE_URL>/thinklink/device/find-device-data' \
-H 'token: <TOKEN>' -H 'Content-Type: application/json' \
--data '{"id":"<DEVICE_ID>","type":"app_attrs"}'Patch limits
For 400 / Invalid device data patch, check the field path, JSON type and limits below. Correct the patch before submitting again, then read it back by device ID.
| Limit | Maximum |
|---|---|
| Operations per patch (set keys + set_paths entries + remove entries) | 1,000 |
| Segments per path | 32 |
| Patch JSON size | 1 MiB |
| Current group and resulting group size | 4 MiB each |
| JSON nesting depth | 64 |
| JSON traversal nodes | 100,000 |
Frontends and SDKs should provide clear messages; the backend remains the final validator. Limits apply to the aggregate patch and data group, not just individual array lengths. Continue using partial updates: set replaces top-level values, set_paths modifies nested fields and remove deletes fields. Arrays are replaced as a whole; duplicate and ancestor/descendant paths are rejected.
Scope and minimal fields
Overview screens primarily need alarms, online/offline status and a few business states such as running, occupied or faulted. Establish the current organization, formal location scope or actual device bindings before calling POST /thinklink/device/find-page-by-fields.
json
{
"current": 1,
"pageSize": 50,
"location_code_subtree": "<building-location-code>",
"fields": ["online"],
"alarm_detail": false
}Replace the placeholder with an actual location in the current organization. Every row includes eui, alarm_status and alarm_desc; select other fields as needed. Request id explicitly for later editing, and name or location_code only when needed for labels or grouping.
fieldsselects base fields, calculatedonline. Attributes and telemetry have separate selectors; do not treattelemetry_dataas a physical column in fields.server_attrs,shared_attrsandprocess_dataaccept field-name arrays ortruefor the whole group. Select telemetry by thing-model ID, for example{"<thing-model-id>":["temperature"]}. Omit an unused selector;falseandnullare not substitutes for omission.- Overviews should not request full configuration, attribute groups, all telemetry or
alarm_detail:trueby default. Load details after a building, space or device is selected. - Use the existing list's
location_codefor the current location; uselocation_code_subtreefor descendants as well. Subtrees use complete path boundaries, not code-prefix matching. Business spaces use their actual device bindings. - Ordinary queries retain current-organization and
PUBLICvisibility; the subtree branch additionally restricts to the current organization. Enforce the intended scope and never fall back from an empty binding or unknown location to the whole organization.
Complete pagination and failure states
The response is {data,total,current,pageSize}. For whole-building or whole-space summaries, fetch all pages according to total, deduplicate by EUI and verify scope coverage. A first page is not a complete summary. Failed pages, stale results or a scope change invalidate completeness.
alarm_status counts each device's current alarms by severity; alarm_desc contains descriptions. Neither is a subtree aggregation endpoint. online uses active_time and twice heart_period, returning false when either is absent; it is not automatically equivalent to a custom _online attribute.
Preserve distinct unrequested, unloaded, failed, stale and missing-field states. Do not replace them with healthy, no alarms, zero or false. Application-attribute projection preserves explicit null and omits only missing keys; follow other groups’ contracts separately. This paginated endpoint reads persisted data, whereas find-device-data reads current cache, so values can temporarily differ after script updates.
Reuse data and cache resources
Reuse requests across cards and views for the same organization, scope and selected fields. Include these in cache keys; switching organization or scope must not reuse old summaries. Load names, models, spatial bindings and app_attrs.__transform_3d separately from frequent status refreshes. Merge updates only where a reliable subscription exists; do not assume new fields already have MQTT delivery.
Upload and replace models, textures, images, videos and documents through the File Management API. Check quota, persist file IDs, obtain and renew access-ticket values as needed, and read /v/:ticket. Both the single-file and organization-total limits are 50 MiB. Load resources by scene and reuse them across status refreshes. Invalidate caches using update_time or a resource version after replacement. Anonymous access requires explicitly enabled sharing.
Application acceptance
Check actual fields, scope, every page, empty bindings, missing fields and failures. Inspect duplicate requests across cards, expired tickets, sharing disabled, and rendering after replacement. Preserve existing application IDs, configuration, routes, menus and business permissions. Verify the actual hosted page; a local build or successful upload is insufficient.
Migrate existing application settings
If an app reads server_attrs.microapp_*, identify the owning device and consuming apps before copying the settings to the appropriate app_attrs path. Verify reading, partial saves and page restoration before retiring the old settings.