Search Machines

GET /api/1/machines combines name, group, and latest-State filters. It requires API authentication; User sessions remain within their group visibility.

Combine filters

Parameter Purpose
limit / offset Page size and starting position
search_filter / search_word Search machine_name, obniz_id, or group_name
group_id Filter by Group ID
connection_model Filter by Controller model
states Latest-State conditions encoded as a JSON string

This example finds Machines with battery voltage below 2.75. It assumes their battery_voltage values are in volts. Replace the base URL and API token, then run it on your server. External Web applications should use the browser SDK.

const states = {
  required: [{
    key: 'battery_voltage',
    conditions: [{ key: 'battery_voltage', comparison: '<', value: 2.75 }],
  }],
  all_state: true,
};
const query = new URLSearchParams({
  limit: '20', offset: '0', states: JSON.stringify(states),
});
const url = new URL('/api/1/machines', 'https://now.example.com');
url.search = query.toString();
const response = await fetch(url, {
  headers: { Authorization: 'Bearer <Account API Token>' },
});
if (!response.ok) throw new Error(`Search failed: ${response.status}`);
const page = await response.json();
// page.count, page.limit, page.offset, page.items

Read State conditions

The required array accepts 1–10 entries, combined with AND. Each entry accepts at most one conditions item; its key must match the outer key. Empty conditions tests whether the State exists.

Strings support = or in. Numbers support =, >, >=, <, <=, or in. An in list has 1–100 values, all strings or all finite numbers. Missing State is not treated as zero.

start and end filter the latest State's update time, not historical measurements. all_state: true returns all States; when omitted with array-form requirements, only the keys used by the filter are returned.

Pagination and group scope

limit accepts 1–100 and defaults to 100; offset starts at 0. Use the response's offset + limit as the next offset, and stop when that value reaches count. Machines and States can change between pages. Save the returned Machine IDs in your application if subsequent work must use a fixed set.

User permissions can include descendant groups, but an explicit group_id filter does not mean a recursive search of those descendants. Visibility and the selected search target are separate constraints.