Quickstart
You need an OhrTech organisation with at least one device, and permission to manage its members (ManageMembers) in the OhrTech Portal.
-
Create a service account. In the OhrTech Portal, open Service accounts and create one named, say,
quickstart. -
Grant it two permissions:
ViewDevicesandSendMessages. Leave its devices, networks and embed sites unlimited for now. You can narrow them later. -
Make a token. Choose New token, pick how long it lasts (30 days to a year), and copy it. It starts with
ohrs_and is shown only once. Keep it in an environment variable:Terminal window export OHR_TOKEN=ohrs_… -
List your devices.
Terminal window curl https://api.ohrtech.net/v1/devices -H "Authorization: Bearer $OHR_TOKEN"Terminal window dotnet run quickstart.csWith
quickstart.csbelow. .NET 10 runs a single.csfile directly; there is no project to create.Each device has a
deviceId. Pick one that isonline. -
Show a message on its screen.
Terminal window curl https://api.ohrtech.net/v1/devices/42/messages \-H "Authorization: Bearer $OHR_TOKEN" \-H "Content-Type: application/json" \-d '{"text": "Hello from the Management API"}'Terminal window dotnet run quickstart.cs -- 42The message appears on the device within seconds. The response is the task that carries it:
GET /v1/devices/42/tasks/{taskId}shows it go frompendingtosuccess.
The whole program
Section titled “The whole program”#:package OhrTech.Management@*// Lists your devices, then shows a message on one of them.// OHR_TOKEN=ohrs_… dotnet run quickstart.cs list devices// OHR_TOKEN=ohrs_… dotnet run quickstart.cs -- 42 …and show a message on device 42using OhrTech.Management;
using var api = OhrManagementClient.ForServiceAccount( Environment.GetEnvironmentVariable("OHR_TOKEN") ?? throw new InvalidOperationException("Set OHR_TOKEN to a service account token."));
foreach (var d in await api.ListDevicesAsync()){ var state = d.Online ? "online" : "offline"; var battery = d.BatteryLevel is { } level ? $"{level}%" : "–"; Console.WriteLine($"{d.DeviceId,6} {d.Serial,-16} {d.FleetName ?? "(no fleet)",-24} {state,-8} battery {battery}");}
if (args.Length > 0 && long.TryParse(args[0], out var deviceId)){ var task = await api.ShowMessageAsync(deviceId, new ShowMessageRequest { Text = "Hello from the Management API" }); Console.WriteLine($"Sent: task {task.TaskId} is {task.Status}");}Where next
Section titled “Where next”- Sign in as a person, for tools your staff run.
- Give each integration only the access it needs.
- Run a recipe: a help desk with remote control, an inventory sync, health alerts.