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 CLI argument; 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 — see Selectors. Exposed as a CLI argument in the Python sample.

Key code

The Python sample exposes the session selector as a CLI 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.

def main():
session = sys.argv[1] if len(sys.argv) > 1 else 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"))

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

Related: JSON Conventions · Selectors · Sessions