Send Device Data via HTTP

This page shows you how to send data via a HTTP client to the Bosch IoT Hub. As exemplary device the Swagger UI of the Bosch IoT Suite API Docs is used.

Preconditions

  • Bosch IoT Hub service was subscribed.
  • A test device has been registered in Bosch IoT Hub.
  • Credentials for the given device have been created in Bosch IoT Hub.
  • A consumer application is connected to the Bosch IoT Hub.

Login to Suite API Docs

To send data through the HTTP Adapter you can use the provided UI of the Suite API Docs. You can open it in a new window and follow this guide:

Suite API Docs: HTTP Adapter

Only authenticated devices are allowed to send messages to Bosch IoT Hub. To prove its identity your device has to pass the credentials registered in the previous steps.

Login to the Suite API Docs by clicking the Authorize button. The username is made up of the auth-id defined for the credential followed by a @ and the id of your tenant.

So for example if you have chosen auth-id: credential001 and your tenant-id is t123456789abcdef123456789abcdef12, the username will be like: credential001@t123456789abcdef123456789abcdef12.

The password is the plaintext password that was created during the credential registration.

Send telemetry messages

  1. Make sure that you have a connected consumer. Otherwise you will receive a 503 Service Unavailable HTTP response.

  2. Navigate to the telemetry section selecting the POST operation.

  3. Press the Try it out button.

  4. For your first tries you can leave the request body as is. The example uses JSON for ease of use. Bosch IoT Hub does not make any restrictions regarding content type. You can use whatever fits your use-case and applications best.

  5. Finally run the request by hitting the Execute button.

  6. Verify that the request was successful (Code 202).

  7. Now your consumer application should receive the message that was forwarded by the Bosch IoT Hub.

Send event messages

Sending event messages works exactly the same way like sending telemetry messages except for two differences:

  • Use the POST operation of the event section.
  • Make sure the consumer application is listening for event messages.