How does the 'register(app_name, uuid)' API function work?

I am currently playing around with API and stumbled over the ‘not so well’ documented ‘register(app_name, uuid)’ function.

One can use this API function to register a new device within an application using a newly created UUID.

Now I am very curious to know how to assign a physical device to that newly registered device!?

Hey @simonkemper,

The .generateUUID() and register(applicationName, uuid) methods are only relevant when coupled with the provisioning of a physical device. For instance, these resin-sdk methods are used by our resin-cli to implement the resin device init command, which is also part of our resin quickstart wizzard:

$ resin device init -h
Usage: device init

Use this command to download the OS image of a certain application and write it to an SD Card.

Notice this command may ask for confirmation interactively.
You can avoid this by passing the `--yes` boolean option.


	$ resin device init
	$ resin device init --application MyApp


    --application, -a, --app <application> application name                   
    --yes, -y                              confirm non interactively          
    --advanced, -v                         enable advanced configuration  


I think @simonkemper is trying to do exactly that? Provision a device through the SDK instead of the device provisioning itself. Would be good to have some more info or context on what happens in normal situations, or really any extra info. At the moment does look curious. :slight_smile:

@imrehg @kostas Yes right! I am exactly trying to do this but I have figured out how the registration process works by taking a deep look into the CLI-Code and making some experiments.

All in all you can pre-assign a device’s image by setting the UUID property in the config.json which I assumed but it wasn’t mentioned. So that was what I was looking for! Basically I wanted to know more about the mechanism behind the scenes …

So this lead to another (two) question:

  1. Has the device('s container) access to the config.json?

  2. What is that “offlineMode=false” setting? And what does it?

@simonkemper - how are you formatting your request to register()? I’m doing a post to with the following payload:

  "application": 569477,
  "device_type": "raspberrypi3",
  "uuid": "0fddadc221c94efc969650509d502194"

I’m getting “device type undefined not found”. Am I sending the wrong thing?