...
3. Enter a registry ID and select a cloud region. For registry naming and size requirements, see Permitted characters and size requirements.
4. Select the protocols that devices in this registry will use to connect to ClearBlade IoT Core: MQTT, HTTP, or both.
...
9. Use the Key and Value fields to add optional device metadata, such as a serial number.
10. Select a Cloud Logging level to determine which device events are sent to Cloud Logging.
...
For ES256, the Device.credentials[i].public_key.key
field must be set to the ec_public.pem
contents (including the header and the footer). The Device.credentials[i].public_key.format
field must be set to ES256_PEM
or ES256_X509_PEM
.
Creating a device with RSA credentials code samples
Node.js
Code Block |
---|
// const cloudRegion = 'us-central1'; // const deviceId = 'my-rsa-device'; // const projectId = 'adjective-noun-123'; // const registryId = 'my-registry'; import { DeviceManagerClient } from '@clearblade/iot'; const iotClient = new DeviceManagerClient({ // optional auth parameters. }); async function createDevice() { // Construct request const regPath = iotClient.registryPath(projectId, cloudRegion, registryId); const device = { id: deviceId, credentials: [ { publicKey: { format: 'RSA_X509_PEM', key: readFileSync(rsaCertificateFile).toString() } } ] }; const request = { parent: regPath, device }; const [response] = await iotClient.createDevice(request); console.log('Created device', response); } createDevice(); |
...
Code Block |
---|
// createRSA creates a device in a registry given RSA X.509 credentials. func createRSA(w io.Writer, projectID string, region string, registryID string, deviceID string, keyPath string) (*iot.Device, error) { ctx := context.Background() service, err := iot.NewService(ctx) if err != nil { return nil, err } keyBytes, err := ioutil.ReadFile(keyPath) if err != nil { return nil, err } device := iot.Device{ Id: deviceID, Credentials: []*iot.DeviceCredential{ { PublicKey: &iot.PublicKeyCredential{ Format: "RSA_X509_PEM", Key: string(keyBytes), }, }, }, } parent := fmt.Sprintf("projects/%s/locations/%s/registries/%s", projectID, region, registryID) response, err := service.Projects.Locations.Registries.Devices.Create(parent, &device).Do() if err != nil { return nil, err } fmt.Fprintf(w, "Successfully created RSA256 X.509 device: %s", deviceID) return response, nil } |
Creating a device with Elliptic Curve (EC) credentials code samples
Node.js
Code Block |
---|
// const cloudRegion = 'us-central1'; // const deviceId = 'my-es-device'; // const projectId = 'adjective-noun-123'; // const registryId = 'my-registry'; import { DeviceManagerClient } from '@clearblade/iot'; const iotClient = new DeviceManagerClient({ // optional auth parameters. }); async function createDevice() { // Construct request const regPath = iotClient.registryPath(projectId, cloudRegion, registryId); const device = { id: deviceId, credentials: [ { publicKey: { format: 'ES256_PEM', key: readFileSync(esCertificateFile).toString() } } ] }; const request = { parent: regPath, device }; const [response] = await iotClient.createDevice(request); console.log('Created device', response); } createDevice(); |
...
4. Click the device ID to go to the Device details page. This page summarizes recent device activity, including the last time a message was published and the most recent error time. This page also shows the device numeric ID.
5. Click the Configuration & state history tab to see the device's recent configuration versions and update times.
...
Deleting devices and registries
Console
You can delete one or more devices from the registry's device list.
...
Delete devices
1. Go to the ClearBlade IoT Core console’s Registries page.
...