# How does the 'register(app\_name, uuid)' API function work?

**URL:** <https://forums.balena.io/t/how-does-the-register-app-name-uuid-api-function-work/377>\
**Category:** Product support\
**Created:** [October 30, 2016, 8:46pm UTC](https://forums.balena.io/t/how-does-the-register-app-name-uuid-api-function-work/377 "2016-10-30T20:46:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonkemper](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/simonkemper/32/128_2.png) [@simonkemper](https://forums.balena.io/u/simonkemper)\
**Post date:** [October 30, 2016, 8:46pm UTC](https://forums.balena.io/t/how-does-the-register-app-name-uuid-api-function-work/377/1 "2016-10-30T20:46:46Z")

</div>

I am currently playing around with [resin.io](http://resin.io) 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!?

---

<div class="post-metadata">

**Author:** ![lekkas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lekkas/32/78_2.png) [@lekkas](https://forums.balena.io/u/lekkas)\
**Post date:** [October 31, 2016, 1:33pm UTC](https://forums.balena.io/t/how-does-the-register-app-name-uuid-api-function-work/377/2 "2016-10-31T13:33:44Z")

</div>

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:

```auto
$ 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.

Examples:

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

Options:

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

```

Best,  
Kostas

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [November 1, 2016, 3:48pm UTC](https://forums.balena.io/t/how-does-the-register-app-name-uuid-api-function-work/377/3 "2016-11-01T15:48:14Z")

</div>

> [@kostas](#):
>
> The .generateUUID() and register(applicationName, uuid) methods are only relevant when coupled with the provisioning of a physical device.

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](https://github.com/resin-io/resin-sdk-python/blob/master/DOCUMENTATION.md#function-registerapp_name-uuid). 🙂

---

<div class="post-metadata">

**Author:** ![simonkemper](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/simonkemper/32/128_2.png) [@simonkemper](https://forums.balena.io/u/simonkemper)\
**Post date:** [November 2, 2016, 9:32am UTC](https://forums.balena.io/t/how-does-the-register-app-name-uuid-api-function-work/377/4 "2016-11-02T09:32:09Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![RQDQ](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/rqdq/32/636_2.png) [@RQDQ](https://forums.balena.io/u/RQDQ)\
**Post date:** [October 23, 2017, 2:51pm UTC](https://forums.balena.io/t/how-does-the-register-app-name-uuid-api-function-work/377/5 "2017-10-23T14:51:11Z")

</div>

@simonkemper - how are you formatting your request to register()? I’m doing a post to `https://api.resin.io/v1/device` 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?
