Skip to main content

SSH API

Authentication

The Thermostat SSH API uses the standard SSH key authentication system built into OpenSSH for access control. In order to access these endpoints you need to establish the SSH connection using an SSH key that is on either an Employee record or a ServerUser record in the Thermostat database. The SSH user used for the connection should always be "thermostat" and the connection should always be established on port 2222. You can test the validity of your credentials by using OpenSSH directly, for example by running ssh thermostat@api.thermostat.fahrenheit.io -p 2222 get_user.

Endpoints

get_user

This API endpoint returns a JSON encoded message containing the details of the requesting user's Thermostat user information.

Response Example:

{"id":1,"slug":"username"}

get_app_config <client/application/stage>

This API endpoint expects a client/application/stage parameter which specifies which application and stage the user is requesting information about, for example fahrenheit/thermostat/development. The endpoint returns a JSON encoded message containing the details of the requested application configuration.

Response Example:

{"repo":"ssh://git@gitlab.com/fahrenheit/thermostat/thermostat.git"}

update_app_config <client/application/stage>

This API endpoint expects a client/application/stage parameter which specifies which application and stage the user is attempting to update, for example fahrenheit/thermostat/development. The endpoint expects to receive a JSON encoded message containing the details of the specified application configuration.

Request Example:

{"repo":"ssh://git@gitlab.com/fahrenheit/thermostat/thermostat.git"}

get_app_data <client/application/stage>

This API endpoint expects a client/application/stage parameter which specifies which application and stage the user is requesting information about, for example fahrenheit/thermostat/development. The endpoint outputs a stream of binary data for the latest backup file for the requested stage of the requested application.

upload_app_data <client/application/stage>

This API endpoint expects a client/application/stage parameter which specifies which application and stage the user is attempting to update, for example fahrenheit/thermostat/development. The endpoint receives a stream of binary data for the new backup file that should be associated with the specified stage of the specified application.