Hackey API reference

Hackey is supplied with an API to control the functions listed below.

  • Issuing a HTTP POST request to outside services when turning the key
  • Lighting Hackey’s LED’s in a specified pattern when receiving a HTTP GET request from outside services.

HTTP request linked to the key switch

For the URL which is set in the web application when turning the key, set ContentType as application/json, and POST JSON as below.

{
  "hackey": {
    "device_id": "<device id>",
    "event": "<what>"
  }
}

*The syntax above can be used with or without line breaks for correct operation.

Within requests above, device ID of the targeted Hackey can be defined in <device id>.  <turn_on> and <turn_off> can set in place of <what>. The first one used when turning the key to the on position; the latter for turning the key to the off position.

Please ignore responses from the access point.

In cases where no response is returned for a long time, the subsequent operation can not be guaranteed. Please set the access point to prevent duplicated requests.

Receiving a trigger from outside services

If you send HTTP/HTTPS request (GET) to the URL that is displayed in Dashboard, Hackey can receive the request and the LED will flash in accordance with your settings.

Operation flow –

  • Send GET request to the URL made in Dashboard in order to light the LED.
  • Hackey lights LED as per the settings for when receiving request.
  • Request header and request body in URL made by a web application will be ignored.
  • If a lighting instruction (GET request) is received, status code 200 will be replied. Additional header and body are not defined.