Jump toSuggest an edit

How to set up and use a REST network

Reviewed on 04 July 2024Published on 01 September 2019

IoT Hub allows you to configure and use REST networks for your IoT applications.

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization
  • Created an IoT Hub

The REST network only allows publishing messages.

How to set up a REST network

  1. Click IoT Hub in the Managed Services section of the side menu. The list of your IoT Hubs displays.
  2. Click the name of the IoT Hub that you want to configure. The hub’s overview page displays.
  3. Click the Networks tab on the hub’s overview page.
  4. Click the Add network button to access the network creation wizard.
  5. Complete the form by specifying the network’s details:
    • Enter a name for your network.
    • Choose REST as the type of network you want to create.
    • Choose a topic prefix your network should publish to. You may leave this empty. All the messages published to this network will have their topics prefixed with this value.
  6. Click Create network. A summary of the network you created, displays. Take note of the two key parameters:
  • The network endpoint.
  • The network secret. This secret will only be shown once. We recommend you write it down to avoid losing it.

Keep this information, you need it to use your REST network.

How to use the REST network

Any HTTP client can be used to publish a message through a REST network. The required headers are:

  • X-Secret: The network secret that was given while creating the network on a hub.
  • X-Topic: The topic that the message should be published on.

Following an example using curl:

> curl -XPOST -H "X-Secret: <network-secret>" -H "X-Topic: <topic>" -d <payload> <network-endpoint>

Use the following values:

  • <network-secret>: Enter here the network secret that was given when you created the network on your hub.
  • <network-endpoint>: Enter here the network endpoint that was given when you created the network on your hub.
  • <topic>: Choose here the topic that suits your needs. This topic will be prefixed with the network topic.
  • <payload>: Enter here the payload you want to publish (a JSON string for example).
See also
How to use the MQTT WebclientHow to set up and use a Sigfox network
Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway