Scaleway DocumentationIoTIoT HubHow to
Set up and use a REST network

Jump toUpdate content

How to set up and use a REST network

Reviewed on 02 June 2021Published on 01 September 2019

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

Requirements:
Note:

The REST network only allows publishing messages.

How to set up a REST network

  1. Click IoT Hub in the IoT Station 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. Be careful, this secret will only be shown once !

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 as example).
See Also