latestOpenAPI 3.1.0Apache License Version 2.02026-08-17498525913.3 KB

40169ccdec5c

device-controller

Update device credentials (updateDeviceCredentials)

During device creation, platform generates random 'ACCESS_TOKEN' credentials. " + Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. You may find the example of device with different type of credentials below:

  • Credentials type: <b>"Access token"</b> with <b>device ID</b> and with <b>device ID</b> below:
{
  "id": {
    "id":"c886a090-168d-11ee-87c9-6f157dbc816a"
   },
  "deviceId": {
    "id":"c5fb3ac0-168d-11ee-87c9-6f157dbc816a",
    "entityType":"DEVICE"
   },
  "credentialsType": "ACCESS_TOKEN",
  "credentialsId": "6hmxew8pmmzng4e3une4"
}
  • Credentials type: <b>"X509"</b> with <b>device profile ID</b> below:

Note: <b>credentialsId</b> - format <b>Sha3Hash</b>, <b>certificateValue</b> - format <b>PEM</b> (with "--BEGIN CERTIFICATE----" and -"----END CERTIFICATE-").

{
  "id": {
    "id":"309bd9c0-14f4-11ee-9fc9-d9b7463abb63"
   },
  "deviceId": {
    "id":"3092b200-14f4-11ee-9fc9-d9b7463abb63",
    "entityType":"DEVICE"
   },
  "credentialsType": "X509_CERTIFICATE",
  "credentialsId": "6b8adb49015500e51a527acd332b51684ab9b49b4ade03a9582a44c455e2e9b6",
  "credentialsValue": "-----BEGIN CERTIFICATE----- MIICMTCCAdegAwIBAgIUUEKxS9hTz4l+oLUMF0LV6TC/gCIwCgYIKoZIzj0EAwIwbjELMAkGA1UEBhMCVVMxETAPBgNVBAgMCE5ldyBZb3JrMRowGAYDVQQKDBFUaGluZ3NCb2FyZCwgSW5jLjEwMC4GA1UEAwwnZGV2aWNlUHJvZmlsZUNlcnRAWDUwOVByb3Zpc2lvblN0cmF0ZWd5MB4XDTIzMDMyOTE0NTczNloXDTI0MDMyODE0NTczNlowbjELMAkGA1UEBhMCVVMxETAPBgNVBAgMCE5ldyBZb3JrMRowGAYDVQQKDBFUaGluZ3NCb2FyZCwgSW5jLjEwMC4GA1UEAwwnZGV2aWNlUHJvZmlsZUNlcnRAWDUwOVByb3Zpc2lvblN0cmF0ZWd5MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECMlWO72krDoUL9FQjUmSCetkhaEGJUfQkdSfkLSNa0GyAEIMbfmzI4zITeapunu4rGet3EMyLydQzuQanBicp6NTMFEwHQYDVR0OBBYEFHpZ78tPnztNii4Da/yCw6mhEIL3MB8GA1UdIwQYMBaAFHpZ78tPnztNii4Da/yCw6mhEIL3MA8GA1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwIDSAAwRQIgJ7qyMFqNcwSYkH6o+UlQXzLWfwZbNjVk+aR7foAZNGsCIQDsd7v3WQIGHiArfZeDs1DLEDuV/2h6L+ZNoGNhEKL+1A== -----END CERTIFICATE-----"
}
  • Credentials type: <b>"MQTT_BASIC"</b> with <b>device profile ID</b> below:
{
  "id": {
    "id":"d877ffb0-14f5-11ee-9fc9-d9b7463abb63"
   },
  "deviceId": {
    "id":"d875dcd0-14f5-11ee-9fc9-d9b7463abb63",
    "entityType":"DEVICE"
   },
  "credentialsType": "MQTT_BASIC",
  "credentialsValue": "{\"clientId\":\"juy03yv4owqxcmqhqtvk\",\"userName\":\"ov19fxca0cyjn7lm7w7u\",\"password\":\"twy94he114dfi9usyk1o\"}"
}
  • You may find the example of <b>LwM2M</b> device and <b>RPK</b> credentials below:

Note: LwM2M device - only existing device profile ID (Transport configuration -> Transport type: "LWM2M".

{
  "id": {
    "id":"e238d4d0-1689-11ee-98c6-1713c1be5a8e"
   },
  "deviceId": {
    "id":"e232e160-1689-11ee-98c6-1713c1be5a8e",
    "entityType":"DEVICE"
   },
  "credentialsType": "LWM2M_CREDENTIALS",
  "credentialsId": "LwRpk00000000",
  "credentialsValue":
       "{\"client\":{ \"endpoint\":\"LwRpk00000000\", \"securityConfigClientMode\":\"RPK\", \"key\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdvBZZ2vQRK9wgDhctj6B1c7bxR3Z0wYg1+YdoYFnVUKWb+rIfTTyYK9tmQJx5Vlb5fxdLnVv1RJOPiwsLIQbAA==\"   }, \"bootstrap\":{ \"bootstrapServer\":{ \"securityMode\":\"RPK\", \"clientPublicKeyOrId\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\":\"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\"}, \"lwm2mServer\":{ \"securityMode\":\"RPK\", \"clientPublicKeyOrId\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\":\"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\"}} }"
}

Update to real value:

  • 'id' (this is id of Device Credentials -> "Get Device Credentials (getDeviceCredentialsByDeviceId)",
  • 'deviceId.id' (this is id of Device). Remove 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity.

Available for users with 'TENANT_ADMIN' authority.

post/api/device/credentials

Request body

createdTimeinteger

Timestamp of the device credentials creation, in milliseconds

credentialsType'ACCESS_TOKEN' | 'X509_CERTIFICATE' | 'MQTT_BASIC' | 'LWM2M_CREDENTIALS'

Type of the credentials

credentialsIdstring required

Unique Credentials Id per platform instance. Used to lookup credentials from the database. By default, new access token for your device. Depends on the type of the credentials.

credentialsValuestring

Value of the credentials. Null in case of ACCESS_TOKEN credentials type. Base64 value in case of X509_CERTIFICATE. Complex object in case of MQTT_BASIC and LWM2M_CREDENTIALS

versioninteger

Example request

{
  "id": {
    "id": "784f394c-42b6-435a-983c-b7beff2784f9"
  },
  "createdTime": 1609459200000,
  "deviceId": {
    "id": "784f394c-42b6-435a-983c-b7beff2784f9",
    "entityType": "DEVICE"
  },
  "credentialsId": "Access token or other value that depends on the credentials type",
  "credentialsValue": "Null in case of ACCESS_TOKEN. See model definition."
}

Response

OK

createdTimeinteger

Timestamp of the device credentials creation, in milliseconds

credentialsType'ACCESS_TOKEN' | 'X509_CERTIFICATE' | 'MQTT_BASIC' | 'LWM2M_CREDENTIALS'

Type of the credentials

credentialsIdstring required

Unique Credentials Id per platform instance. Used to lookup credentials from the database. By default, new access token for your device. Depends on the type of the credentials.

credentialsValuestring

Value of the credentials. Null in case of ACCESS_TOKEN credentials type. Base64 value in case of X509_CERTIFICATE. Complex object in case of MQTT_BASIC and LWM2M_CREDENTIALS

versioninteger

Example response

{
  "id": {
    "id": "784f394c-42b6-435a-983c-b7beff2784f9"
  },
  "createdTime": 1609459200000,
  "deviceId": {
    "id": "784f394c-42b6-435a-983c-b7beff2784f9",
    "entityType": "DEVICE"
  },
  "credentialsId": "Access token or other value that depends on the credentials type",
  "credentialsValue": "Null in case of ACCESS_TOKEN. See model definition."
}