Skip to main content
Version: 3.5.x

00. Device List

Discovers all connected Haply devices via the HTTP REST API — no WebSocket needed. A simple smoke test that the runtime is up and detecting hardware.

What you'll learn:

  • Querying GET /devices to list Inverse3, VerseGrip, and Wireless VerseGrip devices
  • Reading device IDs from the JSON response, grouped by device type
  • Using a session selector to switch between raw device coordinates and a session's application-space view

Workflow

  1. Send GET http://localhost:10001/devices.
  2. Parse the JSON response — three top-level arrays: inverse3, verse_grip, wireless_verse_grip.
  3. Print the device IDs grouped by type. Empty arrays mean no device of that type is detected.
  4. If a session selector is appended as ?session=<selector>, the response is filtered to that session's devices and coordinates are converted to its application space (basis, mount, workspace applied). The Python sample exposes this as a --session SELECTOR CLI argument (accepts :profile:instance, #id, :-1, :0, …) — the same flag with the same help text that Tutorial 08 (HTTP Remote Config) uses, so a selector found here can be pasted directly there. The C++ samples query without a selector.

Parameters

ParameterDefaultPurpose
Service URLhttp://localhost:10001HTTP base URL
Endpoint/devicesDevice discovery endpoint
Session selector(none)?session=:0, ?session=:-1, ?session=:my_profile:0, ?session=co.haply.hub::*:0 (glob wildcards supported) — see Selectors. Exposed as --session SELECTOR in the Python sample (same flag as Tutorial 08).

Key code

The Python sample exposes the session selector as a --session SELECTOR argparse argument. Without it, devices are returned in raw device-space coordinates; with it, they're filtered to the selected session and converted to application space. The help text matches Tutorial 08 (HTTP Remote Config) so a selector found here can be pasted directly there.

def parse_args():
parser = argparse.ArgumentParser(
description="List connected Haply Inverse devices via the HTTP API.")
parser.add_argument(
"--session", type=str, default="",
help=(
"Session selector. Formats:\n"
" :profile:instance by profile name (e.g. ':my_profile:0')\n"
" pattern:instance glob wildcard in profile (e.g. 'co.haply.hub::*:0')\n"
" '*' matches any sequence, '?' one character\n"
" #session_id by numeric id (e.g. '#42' — quote in shells to escape '#')\n"
" :-1 the last active session\n"
" :0 the first session"
))
return parser.parse_args()

def main():
args = parse_args()
session = args.session or None

url = f"{BASE_URL}/devices"
if session:
url += f"?session={session}"
print(f"Querying devices for session '{session}' (application space)\n")
else:
print("Querying all detected devices (device space)\n")

r = requests.get(url, timeout=3)
r.raise_for_status()
data = r.json()

print_devices("Inverse3", data.get("inverse3"))
print_devices("Wired Verse Grip", data.get("verse_grip"))
print_devices("Wireless Verse Grip", data.get("wireless_verse_grip"))
Shipping with the SDK installer

Tutorial 00 is also installed locally with the SDK — look in tutorials/00-haply-inverse-device-list/ under the service install directory.

Source: Python · C++ · C++ Glaze

Related: JSON Conventions · Selectors · Sessions