Add endpoint for LWM2M device

The following is an example request that allows the client application to create a LWM2M endpoint in IMPACT IoT.

Add endpoint for LWM2M device describes the API structure for creating an endpoint for LWM2M device in IMPACT IoT.

Table 1. Add endpoint for LWM2M device
Title Add endpoint for LWM2M device
URL http://<Impact_URL>/m2m/endpoints
Method POST
Content-Type application/json
URL Params

The URL parameters are:

  • serialNumber:[string]: Specifies the serial number of LWM2M device. This parameter is mandatory.

  • identifier:[string]: Specifies the name that uniquely identifies the LWM2M device.

  • address:[string]: Specifies the MSISDN associated with the device.

  • protocol:[string]: Specifies the communication protocol of the device. For LWM2M device, use LWM2M. This parameter is mandatory.

  • groupName:[string]: Specifies the name of the IMPACT IoT group to which the device registers. This parameter is mandatory.

  • additionalParams:[composite]: Specifies the additional parameters for LWM2M Payload. This must be passed empty, if no additional parameters are specified. Example: "additionalParams":{}.

    secMode: Specifies the security mode used by the LWM2M client for device registration. It can take either the value Pre-Shared Key (PSK) or Raw Public Key (RPK).

    The bootstrap.secMode, bootstrap.psk, bootstrap.pskIdentity, bootstrap.publicKey are the bootstrap credentials provided during pre-provisioning of the device.

    A sample format PSK bootstrap credentials is as follows:
    {
    "additionalParams":{
    "bootstrap.secMode": "PSK",
    "bootstrap.pskIdentity": "test1"
    "bootstrap.psk": "dGVzdDE="
    },
    "groupName": "abcdxyz",
    "protocol": "LWM2M",
    "serialNumber": "511224901110663",
    "identifier":"511224901110663"
    }
    A sample format for RPK bootstrap credentials is as follows:
    {
    "additionalParams":{
    "bootstrap.secMode": "RPK",
    "bootstrap.publicKey": "
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEji9A5dNme
    8imybyECI7q+vWi+
    Sj0YVnNgPvT998DyQc+gxIg9veWkQAebvLT
    uUsWAaHOq4PldS9WToCgjFwawQ==
    -----END PUBLIC KEY-----",
    },
    "groupName": "abcdxyz",
    "protocol": "LWM2M",
    "serialNumber": "511224901110666",
    "identifier":"511224901110666"
    }
    • If the value is PSK, the following parameters must be filled
      • psk:[string]: Specifies the value of the Secret Key resource that is used by the LWM2M client as per LWM2M Object: LWM2M Security. The PSK must be b64 encoded. It is mandatory to provide psk, if pskIdentity is provided, and vice versa.

      • pskIdentity:[string]: Specifies the value of the Public Key or Identity Resource that the LWM2M client uses.

        Note: Non-ASCII characters are supported for PSK Identity and PSK password parameters.
        Note: In IMPACT IoT, the Pre-Shared Key (PSK) uses a Base64 encoded binary data format at all levels (Device and tenant).
        A sample format PSK registration credentials is as follows:
        {
        "additionalParams":{
        "secMode": "PSK",
        "pskIdentity": "test",
        "psk: "dGVzdA=="
        },
        "groupName": "abcdxyz",
        "protocol": "LWM2M",
        "serialNumber": "511224901110666",
        "identifier":"511224901110666"
        }
    • If the value is RPK, the following parameter must be filled:

      publicKey:[string]: Specifies the public key of the LWM2M client.

      A sample format is as follows:
      {
      "additionalParams":{
      "secMode": "RPK",
      "publicKey": "-----BEGIN PUBLIC KEY-----
      MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEji
      9A5dNme8imybyECI7q+vWi+
      Sj0YVnNgPvT998DyQc+gxIg9veWkQAebvLTuUsWAa
      HOq4PldS9WToCgjFwawQ==
      -----END PUBLIC KEY-----",
      },
      "groupName": "abcdxyz",
      "protocol": "LWM2M",
      "serialNumber": "511224901110666",
      "identifier":"511224901110666"
      }
      When an LWM2M device is pre-provisioned over SCEF with valid externalId or scefmsisdn, following is the sample format to be filled:
      
      {
      "serialNumber":"urn:nai:20100775092020",
      "protocol":"LWM2M",
      "groupName":"sep.sepp",
      "additionalParams":{
      "externalId": "ext-201102300920207"
      }
      }

      or

      {
      "serialNumber":"ntc-kjio",
      "protocol":"LWM2M",
      "groupName":"sep.sepp",
      "additionalParams":{
      "scefMsisdn": "+3220100775092020"
      }
      }
  • customAttributes: Specifies the custom attributes with designated values. This can take a maximum value of 512 varchar. This is an optional parameter.

    Custom attributes are part of call back URL notification as shown in the following sample report:

    {"reports":[{"serialNumber":"urn:imei:test",
    "timestamp":1540825091125,"subscriptionId":"b4274172-
    0c5b-4aae-8447-4b6a1486d815",
    "resourcePath":"3/0/10","value":"15.0",
    "customAttributes":{"Key2":"Value2","Key1":"Value1"}}],
    "registrations":[],"deregistrations":[],
    "updates":[],"expirations":[],"responses":[]}
    Note:
    1. When a customAttribute is provided, a new column for CUSTOM_ATTRIBUTES is created in DC_DEVICE table.
    2. In GET http://<impact_url>/m2m/endpoints/\{SerialNumber} REST API, the custom attributes are not part of response payload.
Data Params

msg:[string] : info/warning/error message

Success Code
Response Code: 200
Error Code
400 : Bad Request 
401 : Unauthorized 
404 : Not Found 
Sample Call Curl:
curl -X POST --header 'Content-Type: application/json' 
--header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' -d 
{
"additionalParams":{
"secMode": "PSK",
"pskIdentity": "test1"
"psk": "dGVzdDE="
},
"groupName": "test",
"protocol": "LWM2M",
"serialNumber": "511224901110663",
"identifier":"511224901110663"
}
 
curl -X POST --header 'Content-Type: application/json' 
--header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' -d 
{
"additionalParams":{
"bootstrap.secMode": "RPK",
"bootstrap.publicKey": "-----BEGIN PUBLIC KEY-----MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEji
9A5dNme8imybyECI7q+vWi+Sj0YVnNgPvT998DyQc+gxIg9veWkQAebvLTuUsWAaHOq4PldS9WToCgjFwawQ==
-----END PUBLIC KEY-----",
},
"groupName": "test",
"protocol": "LWM2M",
"serialNumber": "511224901110666",
"identifier":"511224901110666"
}
Response Body:
{
"msg": "Device Added Successfully", "Code": 3000
}
Notes

In case of No Security additionalParams are not required.

serialNumber, protocol, and groupName are mandatory parameters.