Multicontainer API for download status

support

#1

I have just upgraded to use the multi-container resin. This has overall been a very easy update, however, I am looking to access the current state of my main container using the node-sdk. I am only able to access the device model which returns the status of the device as “Idle”. I can see that now the containers can be downloaded separately the device is idle however for our testing systems we wait for the device to finish downloading updates in order to begin tests.

Is there an unofficial API that I can use in order to access the state of the containers running on the device? I am happy to add authorisation tokens where needed in order to make this call manually.

Thanks in advance


#4

From looking at the network requests from the dashboard the following is the cURL command to access the download status of the containers running on the device. To use this for your own device please change RESIN_TOKEN and DEVICE_UUID.

curl  --header 'authorization: Bearer RESIN_TOKEN' \
    'https://api.resin.io/v4/device?$filter=startswith(uuid,%DEVICE_UUID%27)&$expand=image_install($select=id,download_progress,status,install_date&$filter=((tolower(status))%20ne%20(%27deleted%27))&$expand=image($select=id&$expand=is_a_build_of__service($select=id,service_name)),is_provided_by__release($select=id,commit)),gateway_download($select=id,download_progress,status&$filter=((tolower(status))%20ne%20(%27deleted%27))&$expand=image($select=id&$expand=is_a_build_of__service($select=id,service_name))),belongs_to__application($select=id,app_name,application_type,device_type,git_repository,depends_on__application&$expand=user($select=id,username)),device_config_variable($select=name,value),device_tag($select=tag_key,value),manages__device($select=device_name,device_type,is_online,id,last_connectivity_event,provisioning_state,last_seen_time,download_progress,provisioning_progress,uuid,is_on__commit),is_managed_by__device($select=id,device_name,uuid,belongs_to__application)&$select=*'

I imagine that a lot of this can be shortened


#6

I’ve opened an issue to track this: https://github.com/resin-io/resin-sdk/issues/489


#7

And there’s ongoing work around support for multicontainer in the SDK being tracked under https://github.com/resin-io/resin-sdk/issues/411


#8

Hi @hpgmiskin, this does actually exist in the SDK, it’s just only available on the beta release, which supports multicontainer, but isn’t totally completed yet. To use this, you need to install with:

npm install resin-sdk@beta

and then use resin.models.device.getWithServiceDetails()

Note that the MC SDK is still in a state of flux though: some features aren’t yet complete (notably including environment variables), and you’ll want to pin a specific release, as there may be breaking changes before the final release.