We integrated a broker for standard CoAP devices with the middlware platform of IoT Creators.
Even when the portal application of IoT Creators doesn’t support standard CoAP yet we want to provide you the possibility to play arround with it and do some tests.
In the following I describe the steps to register a standard CoAP device and subscribte to it with the API. By this the messages of the device can be forwarded to your application URL in the same way like it is done by the portal application.
As UDP or the Neul protocol standard CoAP requires the usage of an IoT Creators SIM card and you can reach the CoAP server at IP 172.27.131.180 and port 5683 only by setting APN: cdp.iot.t-mobile.nl (or scs.telekom.tma.iot if you use SIM card from Magenta Austria)
1. Register your application URL for the API user
You need to register at least a dummy application URL for the
API user because otherwise it will not be possible to create
new devices via the API.
You find the username and the password of your API user in the
page “YOUR APPLICATION SERVER” of your IoT Creators Projects.
REQUEST PUT https://api.scs.iot.telekom.com:443/m2m/applications/registration
REQUEST HEADERS: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Basic <base64(API-USER:API-USER-PASSWORD)>'
}
REQUEST BODY: {
'url': 'https://dev.scs.iot.telekom.com/scs-callback-dummy',
'headers': {
'key1':'value1'
}
}
RESPONSE BODY: {
"msg": "Success",
"code": 1000
}
2. Create the Std. CoAP device in IoT Creators
You find the username and the password of your API user in the
page “YOUR APPLICATION SERVER” of your IoT Creators Projects.
You find there also the “groupName” for the request body in
this page as well.
You can add a list of key/value pairs as addtional “customAttributes”
to the device. Those key/value pairs are passed along with each
message of the device to the configured application URL.
REQUEST POST https://api.scs.iot.telekom.com:443/m2m/endpoints
REQUEST HEADERS: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Basic <base64(API-USER:API-USER-PASSWORD)>'
}
REQUEST BODY: {
'serialNumber': 'IMEI:512668894698385',
'groupName': 'CON_0000002299',
'protocol': 'HTTP',
'additionalParams': {
'adaptationLayerName': 'STDCOAP_TEST'
},
'address': '',
'identifier': '',
'customAttributes': {
'deviceType': 'Efento'
}
}
RESPONSE BODY: {
"msg": "Device added successfully",
"code": 3000
}
3. Create subscription for the Std. CoAP device
Because the support for Standard CoAP devices are not 100%
finished in the IoT Creators portal I recommand to
add the suscription also with the API.
REQUEST POST https://api.scs.iot.telekom.com:443/m2m/subscriptions?type=resources
REQUEST HEADERS: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Basic <base64(API-USER:API-USER-PASSWORD)>'
}
REQUEST BODY: {
'subscriptionType': 'resources',
'groupName': 'CON_0000002299',
'deletionPolicy': 0,
'resources': [
{
'conditions': {},
'resourcePath': 'uplinkMsg/0/data'
},
{
'conditions': {},
'resourcePath': 'downlinkMsg/0/data'
}
],
'criteria': {
'serialNumbers': ['IMEI:512668894698385']
}
}
RESPONSE BODY: {
"subscriptionId": "8974985d-fa8c-472d-8ae3-202e18143e1d",
"msg": "Success",
"code": 1000
}
Have Fun 🙂
Regards, Roland