Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sometimes you need to send data without going through the SF Workheld Sense Edge. This thing is possible by using the SF Workheld Sense MQTT API Endpoint.

API Endpoint Structure

1. Topic

You can set different information at this level like 'tenant', 'thing' or 'compression-type' (separated by the '/').

...

crane=Thing

lz4 = Compression-Type

2. Payload

The payload is JSON-type data where you can set the events you want to be stored in the database. Example of a payload:

...

Info

As a recommendation is better to "combine" several messages into one "events", rather than sending individual messages very often.

MQTT client

In order to be able to use the API, you have to set up a Message Queuing Telemetry Transport (MQTT) client. This client will connect to the SF Workheld Sense MQTT Broker and then you can send data to the platform.

...

Once the connection is established you can send data to the platform.

Example of sending data

Before sending data to the platform, you need to have an event schema set up so the data can be stored. We will consider for this example the following event schema(published):

...

Then you can check in the platform in the dataset editor if the data for your schema was inserted:

...

Frequently encountered problems

Timestamp format

The timestamp should be converted in UNIX time in milliseconds

Wrong usage of the Data property

The custom-created attributes at the event schema level will be set under the 'Data' property of the event item.

...

Connect an MQTT client without a certificate

This would be possible only if the certificate validation is disabled on the customer side. Synchronize with the Senseforce Workheld team.