Systematic Reboot with REST API and Node-RED example


There are many ways to achieve this result. The REST API end-point can be called inside an app or from outside. Someone may want to create an app that is able to manage this task. In this guide we are going to see how this task can be achieved easily with the web-interface and Node-RED. 

  • Being able to use REST API with Node-RED
  • Basic REST API comprension
Equipment needed
  • ctrlX CORE with 2.02 or higher.
  • Node-RED installed for the last part.
  • Internet access for the palette.
Test the API

To test the reboot API is quite easy! We need to go to the API page, the link is already on the top-right:


Then we need to select the right API category which is "System-API":

System APISystem API

What we need to do is to create a "reboot task" but first don't forget to authorize using the Authorize button! Authorize ButtonAuthorize ButtonWe're almost done! We have to find the Task section (1) then move to "Create a new task" (2) and select reboot then click on "Try it out" (3).

Try a taskTry a task

Clicking on "Execute" the system will send a post containing the reboot request!

REST API exampleREST API example

Now the system is rebooting!

Automatize with Node-RED 

Here is the final code. Really easy, any time that the "cron-plus" or the "inject" nodes emits a signal the device is rebooted.

Node-Red CodeNode-Red Code

To implement this the "cron-plus" node has been used (just because personally I find it really easy and configurable). To have it we have to install with the palette this extension:

Node-RED Palette CronNode-RED Palette Cron

Once we have it the configuration is really easy, just add the node and configure the schedule!

Configure the scheduleConfigure the schedule

I personally use the "Easy Expression Builder" because I am lazy. Anyway, it is really easy to configure and adjust.

Easy ConfigurationEasy Configuration

Easy Configuration ExampleEasy Configuration Example

Have Fun 😎

Hello, I am Mauro a ctrlX DEVELOPR at night and an Application Engineer during the day 😎 . Ask me anything about ctrlX AUTOMATION but my best topics are IoT, AI, SDK and Communication!
Must Read