Connected Workers Assets

The Connected Workers Assets API lets you build structured, table‑like asset data sets — physical assets such as pumps, motors, valves, and instruments — that your workers browse and that can be attached to a location.

The model is identical to Locations: an asset table has a name, a key, columns, and items (rows). Everything in the Locations guide — keys, the 18 endpoints, column types, batch insert, truncate, errors — applies here unchanged; only the base path and two asset‑specific relationships differ. This page covers what's different.

Workspace 7
└── Asset table 21 "Assets"  (key: assets)
    ├── Columns:  EQUNR (key: equnr, text, primary key) · Name (key: name, text, title)
    │             · Location (key: location, reference → functional-locations)
    └── Items (rows):
          { "id": 5001, "equnr": "EQ-5001", "name": "Centrifugal Pump", "location": "FL-1001" }

Base URL & auth

Every endpoint is scoped to a workspace and served under:

https://api.treedis.com/v2/api/workspaces/{workspaceId}/cw/assets

All endpoints require authentication (OAuth2 Bearer token or API key), and the caller must have access to the workspace. An API key is bound to a single workspace and can only address its own. See Authentication.

Endpoints

The full set mirrors Locations — substitute assets for locations in every path:

Method Path (under /v2/api/workspaces/{workspaceId}/cw/assets) Purpose
GET / POST `` (collection) List tables / create a table
POST /bulk Batch insert tables
GET / PUT / DELETE /{tableId} Get / update / delete a table
POST /{tableId}/bulk Batch insert into a table (columns + rows)
GET / POST /{tableId}/columns List / create a column
GET / PUT / DELETE /{tableId}/columns/{columnId} Get / update / delete a column
GET / POST /{tableId}/items List rows / insert a row
GET / PUT / DELETE /{tableId}/items/{itemId} Get / update / delete a row
POST /{tableId}/items/truncate Truncate items (delete all rows)
# create an asset table
curl -X POST "https://api.treedis.com/v2/api/workspaces/7/cw/assets" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Assets", "status": "active" }'

For the field‑level schemas of tables, columns, and items, and the column‑type enum (text · number · date · checkbox · hierarchyParent · reference · locationTag · space · tagStatus), see the Locations guide — they are the same.

What's specific to Assets

1. Linking an asset to a location

Attach an asset to a place by adding a reference column that points at a location table, then setting that column on the row to the location row's primary‑key value:

# a column on the Assets table that references the Functional Locations table
curl -X POST "https://api.treedis.com/v2/api/workspaces/7/cw/assets/assets/columns" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Location", "type": "reference", "settings": { "table": "functional-locations" } }'

# a row that lives at FL-1001
curl -X POST "https://api.treedis.com/v2/api/workspaces/7/cw/assets/assets/items" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{ "equnr": "EQ-5001", "name": "Centrifugal Pump", "location": "FL-1001" }'

Worker features (notes, forms, checklists) are filed against the location the asset resolves to — assets are a browse/picker surface, not a feature anchor of their own.

2. Nesting assets within assets

Assets have their own optional parent/child tree, independent of the location link. Add a hierarchyParent column and point a row's value at the parent asset row — e.g. a sub‑assembly under a machine. Treedis rejects an assignment that would create a circular reference (400).

Batch insert

Push a whole asset export in one call. The Assets surface's batch envelope key is assets:

curl -X POST "https://api.treedis.com/v2/api/workspaces/7/cw/assets/bulk" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "assets": [
      {
        "name": "Assets", "status": "active",
        "columns": [
          { "name": "EQUNR", "key": "equnr", "type": "text", "isPrimaryKey": true },
          { "name": "Name", "type": "text" },
          { "name": "Location", "type": "reference", "settings": { "table": "functional-locations" } }
        ],
        "items": [
          { "equnr": "EQ-5001", "name": "Centrifugal Pump", "location": "FL-1001" }
        ]
      }
    ]
  }'

You can also push assets alongside locations and lists in a single unified call — POST /v2/api/workspaces/{workspaceId}/cw/bulk with a tables array where each table sets its own type ("type": "asset" for these). See Batch insert by type.

Errors

Same envelope and status codes as Locations: 400 for validation / circular hierarchy / unresolvable key‑or‑column, 404 for a missing table, column, or item.

See the Connected Workers Assets tag in the API Reference for the full request and response schemas.