With Version 2024.07.12 we added support for API. It is now possible to restart and shut down the device using API. 


Below is a guide on how to use the API for these purposes.


In order to use this feature, API must be enabled from Device Management -> Security. 


A random API key is automatically generated but it is also possible to set a custom key.





Rebooting the Device


Description: Reboots the device

Endpoint: /api/v1/system/reboot

Method: POST

Authentication: Authentication can be done using either the apiKey query parameter or the Authorization header


Query Parameter

/api/v1/system/reboot?apiKey=<<your AirServer API key here>>


Header:

Authorization: Basic <<your AirServer API key here>>

Example:

reply = await fetch('https://<<AirServer IP address>>/api/v1/system/reboot?apiKey=<<your AirServer API key here>>',
      {
        method: 'POST'
      });
    if (!reply.ok) {
      console.log('request failed: ' + reply.statusText);
    }



Shutting Down the Device


Description: Powers the device off

Endpoint: /api/v1/system/powerOff

Method: POST

Authentication: Authentication can be done using either the apiKey query parameter or the Authorization header


Query Parameter:

/api/v1/system/powerOff?apiKey=<<your AirServer API key here>>


Header:

Authorization: Basic <<your AirServer API key here>>


Example:

reply = await fetch('https://<<AirServer IP address>>/api/v1/system/powerOff?apiKey=<<your AirServer API key here>>',
      {
        method: 'POST'
      });
    if (!reply.ok) {
      console.log('request failed: ' + reply.statusText);
    }