Connecting Internet devices

If your device does not support one of our integrated connectivity forms, like LoRa or M2M, you can connect your device directly to KPN Things over the Internet.

Internet Device registration

To register the device you need to fill the following details:

  • DvnUUID - UUID to uniquely identify the Device data coming in.

  • Shared Secret - The pre-shared password used for authorizing ingestion of IoT data from the device by the system.

When generating your own DvnUUID we advice to use a Version 4 UUID.

HTTPS

Internet-connected devices can send their data using HTTPS.

The request

Base URL: https://prod.dm.kpnthings.com

POST /ingestion/ip/senml/v1 HTTP/1.1
Things-Message-Token: <messageToken>
Content-Length: <nrBytes>

[{"bn":"urn:dev:DVNUUID:<dvnuuid>:","bt":<timestamp>},<measurements>]

Body

The body of the HTTP request should be a valid SenML pack. For more information see the SenML documentation.

Base time

The base time bt in the SenML pack is optional, because not all devices keep track of the absolute time. If Things Data Management receives a message without base time, the moment that the message is received will be filled in as base time.

Things Message token

For device authentication we introduce a pre-shared secret for each device. This secret is used by the device to generate message tokens that are SHA256-hashes which are send in the Things-Message-Token header of the request. This token can be used by Things to validate the source of the message. At the same time it prevents tampering with the measurement values.

The secret should be at least 30 characters long and no more then 100, is case sensitive and can contain all ASCII characters: ^[0-9a-zA-Z]{30,100}$

The pre-shared secret is used directly for message token calculation. There is no challenge protocol or no session keys, because we rely on the secure channel for complete integrity.

The message token is calculated as following:

messageToken = sha256({requestBody}{sharedSecret})

The requestBody used for the hash should be identical as the body send in the HTTPS request. Preferably strip the from all white space characters before putting it in the hash and the HTTPS request.

The response

When you send data to KPN Things using a HTTP request, the HTTP response is used to transmit a possible downlink message to your device. Only if a downlink message is in status Executing it will be send, and only one downlink message is send at a time.

A downlink message will be structured as SenML in JSON format. Learn more about downlink communication.

Response code

Using the HTTP response code you can debug some common problems:

MQTT

Read all about the use and possibilities of MQTT ingestion on the next page.

Last updated