Device Creation

Device Creation

mutation {
  createLoraDevices(input:{
    workspace:"e55e1602-c4a8-4d2e-9848-f44296667c5f",
    plan:"free",
    planCode:"",
    productKind:NEW,
    newProductName:"My New Product",
    networkServer:"Helium",
    devices:[
      {
        devEui:"99f83ad2b5c7dead", 
        name:"My First Device"
      }
    ],
  }) {
    ok
    devices {
      id
      verboseName
      serialNumber
      product {
        id
      }
    }
  }
}

Important Notes

For the plan:"" and planCode:"" parts you can as well select the plan you want your devices to be in. For paid plans, make sure that you have setup your billing information under Billing. The options are:

You can use your personalised plan and code, in case you bought a package. In that case, ask the support team about the plan and use your code to redeem devices on the planCode:""section.

If you create a device this way, then a new product is also created automatically (the Product Type is set to NEW).

Therefore, in the above mutation, the Product ID is also requested as the return type.

For the networkServer:"" part you have of course various options. You can add your devices to any of the integrated LNS:

The field is not case-sensitive, so you can indifferently write: networkServer:"TTI" or networkServer:"tti" and they both should work.

For adding devices to our Datacake LNS you will have to provide extra information about your devices, including the AppEUI (or JoinEUI), the AppKey, the device class and the frequency range you are working with.

The supported frequency ranges are:

The supported classes are:

Here an example:

Add Fields to Product

If you want to add new fields in the database to the new product you created using the above query, please use the following query.

Important Notes

To be able to identify the product in the mutation, you have to pass the product ID (key productId).

You can get this either via a GraphQL query, or you can use the above mutation for the creation of a new device (and subsequent product), which returns the product ID of the created product as a return if successful.

Node-RED Example

Function Node Code

  • The following code can be used as a function node.

  • It creates a new and empty Device using the "light" plan.

  • You will need billing enabled on the workspace and the token you are using for this action needs to have device creation and billing rights.

Last updated

Was this helpful?