The first step in controlling connected devices or a connected ACS is to retrieve the newly-connected set of devices or ACS.
Retrieve Connected Devices
Use this connected_account_id in a List Devices command to retrieve the devices that your user has just connected to Seam.
If you set wait_for_device_creation to false when creating the Connect Webview, you should wait for the connected_account.completed_first_sync event before retrieving the user's devices. This event indicates that Seam has finished the first sync of the connected account and the devices are now available.
Code:
# Retrieve all devices for the connected_account_id.connected_devices = seam.devices.list( connected_account_id="11111111-1111-1111-1111-222222222222")
# Retrieve all devices for the connected_account_id.connected_devices=$(# Use GET or POST.curl-X'GET' \'https://connect.getseam.com/devices/list' \-H'accept: application/json' \-H"Authorization: Bearer ${SEAM_API_KEY}" \-H'Content-Type: application/json' \-d'{ "connected_account_id": "11111111-1111-1111-1111-222222222222" }')
Output:
{"devices": [ {"connected_account_id":"11111111-1111-1111-1111-222222222222","device_id":"11111111-1111-1111-1111-444444444444","display_name":"Front Door Lock","is_managed":true, ... }, ... ],"ok":true}
Code:
// Retrieve all devices for the connected_account_id.constconnectedDevices=awaitseam.devices.list({ connected_account_id:"11111111-1111-1111-1111-222222222222"});
# Retrieve all devices for the connected_account_id.connected_devices = seam.devices.list( connected_account_id: "11111111-1111-1111-1111-222222222222")
// Retrieve all devices for the connected_account_id.$connected_devices = $seam->devices->list( connected_account_id:"11111111-1111-1111-1111-222222222222");
Output:
[ {"connected_account_id":"11111111-1111-1111-1111-222222222222","device_id":"11111111-1111-1111-1111-444444444444","display_name":"Front Door Lock","is_managed":true, ... }, ...]
Code:
// Retrieve all devices for the connectedAccountId.var connectedDevices =seam.Devices.List( connectedAccountId:"11111111-1111-1111-1111-222222222222");
Output:
{"connected_account_id":"11111111-1111-1111-1111-222222222222","device_id":"11111111-1111-1111-1111-444444444444","display_name":"Front Door Lock","is_managed":true, ...}...
Code:
// Retrieve all devices for the connectedAccountId.var connectedDevices =seam.devices().list(DevicesListRequest.builder().connectedAccountId("11111111-1111-1111-1111-222222222222").build());
Output:
[ {"connected_account_id":"11111111-1111-1111-1111-222222222222","device_id":"11111111-1111-1111-1111-444444444444","display_name":"Front Door Lock","is_managed":true, ... }, ...]
Code:
// Retrieve all devices for the ConnectedAccountId.connectedDevices, err := client.Devices.List( context.Background(), &api.DevicesListRequest{ ConnectedAccountId: api.String("11111111-1111-1111-1111-222222222222"), },)if err !=nil {return err}returnnil
Output:
[ {"connected_account_id":"11111111-1111-1111-1111-222222222222","device_id":"11111111-1111-1111-1111-444444444444","display_name":"Front Door Lock","is_managed":true, ... } ...]
Retrieve a Connected Access Control System
Use this connected_account_id in a List ACS Systems command to retrieve the ACS that your user has just connected to Seam.
If you set wait_for_device_creation to false when creating the Connect Webview, you should wait for the connected_account.completed_first_sync event before retrieving the user's ACS. This event indicates that Seam has finished the first sync of the connected account and the acs_system is now available.
Code:
# Retrieve all acs_systems for the connected_account_id.connected_acs_systems = seam.acs.list( connected_account_id="11111111-1111-1111-2222-111111111111")
# Retrieve all acs_systems for the connected_account_id.connected_acs_systems=$(# Use GET or POST.curl-X'GET' \'https://connect.getseam.com/acs/systems/list' \-H'accept: application/json' \-H"Authorization: Bearer ${SEAM_API_KEY}" \-H'Content-Type: application/json' \-d'{ "connected_account_id": "11111111-1111-1111-2222-111111111111" }')
// Retrieve all acs_systems for the connected_account_id.constconnectedAcsSystems=awaitseam.acs.systems.list({ connected_account_id:"11111111-1111-1111-2222-111111111111"});
// Retrieve all acs_systems for the connected_account_id.$connected_acs_systems = $seam->acs->systems->list( connected_account_id:"11111111-1111-1111-2222-111111111111");
// Retrieve all acs_systems for the connectedAccountId.var connectedAcsSystems =seam.SystemsAcs.List( connectedAccountId:"11111111-1111-1111-2222-111111111111");