MyKegerator API Documentation
Accessing The API
The MyKegerator.net API is accessible via HTTP and HTTPS using standard HTTP 1.0/1.1 request formatting. An API key is required and should be kept secret.API URL: | http://api.mykegerator.net/ |
Secure API URL: | https://api.mykegerator.net/ |
A valid HTTP 1.0/1.1 request must be used, and the Host: header field should be set to: Host: api.mykegerator.net .
Full Example Request:
POST /pour/add?key=awajkca0u09wnmawd808nmhawdanbcw1&device_id=1&tap_id=1&pulses=3004
Host: api.mykegerator.net
User-Agent: MyKegerator.net - 1.0
Host: api.mykegerator.net
User-Agent: MyKegerator.net - 1.0
API Key
An API key will be issued to all users upon request. This key must be used in all requests to the MyKegerator.net API, and any requests not containing the key will be denied.The API key should be passed as a parameter on the end of the API request URL. For example the following POST request highlights the correct usage of the API Key:
POST /pour/add?key=awajkca0u09wnmawd808nmhawdanbcw1
To generate your API key follow these steps:
- Login to the MyKegerator.net site
- Click "Account Settings" on the top right
- Click "Account Info" on the left menu
- Under "API Key" click "Generate API Key"
Kegerator::Compressor Method
Description: Updates MyKegerator.net with the kegerator's compressor status.Method: POST
Required Parameters:
- key
- device_id (int)
- status (bool)
- value (float)
Sample Request:
POST /kegerator/compressor?key=awajkca0u09wnmawd808nmhawdanbcw1&device_id=1&status=1&value=39.4
Host: api.mykegerator.net
Host: api.mykegerator.net
Sample Response:
HTTP/1.1 200 OK
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"Success"}
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"Success"}
Returned JSON Parameters:
- status
- result (Success|Failure)
Additional Request Information
device_id - This parameter is required. This value can be determined by the "Device ID" listed in your "Account Settings->Devices" section. This is a unique value per device.
value - This parameter is required. The value of this parameter should be an integer, and is a direct representation of the measures degress of the fridge when the compressor status changed.
Kegerator::Temp Method
Description: Retrieves Kegerator temperature settings from MyKegerator.netMethod: GET
Required Parameters:
- key
- device_id (int)
Sample Request:
GET /kegerator/temp?key=awajkca0u09wnmawd808nmhawdanbcw1&device_id=1
Host: api.mykegerator.net
Host: api.mykegerator.net
Sample Response:
HTTP/1.1 200 OK
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"Success","control_temp":1,"high_temp":45,"low_temp":32,"sensor_id":2}
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"Success","control_temp":1,"high_temp":45,"low_temp":32,"sensor_id":2}
Returned JSON Parameters:
- status
- result (Success|Failure)
- control_temp (1|0)
- high_temp (int)
- low_temp (int)
- sensor_id (int)
Additional Request Information
device_id - This parameter is required. This value can be determined by the "Device ID" listed in your "Account Settings->Devices" section. This is a unique value per device.
Additional Response Information
control_temp - Whether or not the user wants the MyKegerator.net device to act as the thermostat for the fridge.
high_temp - The high_temp setting of the fridge
low_temp - The low_temp setting of the fridge
sensor_id - The ID of the sensor that is doing the monitoring within the fridge
Pour::Add Method
Description: Adds a new pour to the current active keg on the specified tap.Method: POST
Required Parameters:
- key
- device_id (int)
- tap_id (int)
- pulses (int)
- rfid (32-bit int)
Sample Request:
POST /pour/add?key=awajkca0u09wnmawd808nmhawdanbcw1&device_id=1&tap_id=1&pulses=3004
Host: api.mykegerator.net
Host: api.mykegerator.net
Sample Response:
HTTP/1.1 200 OK
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"success","ounces_poured":18}
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"success","ounces_poured":18}
Returned JSON Parameters:
- status
- result (200|500)
- ounces_poured (int)
Additional Request Information
device_id - This parameter is required. This value can be determined by the "Device ID" listed in your "Account Settings->Devices" section. This is a unique value per device.
pulses - This parameter is required. The value of this parameter should be an integer, and is a direct representation of the number of pulses making up the pour. The API calculates the number of ounces poured from this value based on the flowmeter assigned to the tap.
Pour::Last Method
Description: Retrieves information on the last pour for the specified tapMethod: GET
Required Parameters:
- key
- device_id (int)
- tap_id (int)
Sample Request:
GET /pour/last?key=awajkca0u09wnmawd808nmhawdanbcw1&device_id=1&tap_id=1
Host: api.mykegerator.net
Host: api.mykegerator.net
Sample Response:
HTTP/1.1 200 OK
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"ounces_poured":18.21,"time_stamp":"1343500237","status":"200","result":"Success","Oh Hey!":{"keg_id":"76","pints_remaining":1}}
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"ounces_poured":18.21,"time_stamp":"1343500237","status":"200","result":"Success","Oh Hey!":{"keg_id":"76","pints_remaining":1}}
Returned JSON Parameters:
- status
- result (200|500)
- ounces_poured (float)
- time_stamp (int)
- $beer name
- keg_id (int)
- pints_remaining (int)
Additional Request Information
device_id - This parameter is required. This value can be determined by the "Device ID" listed in your "Account Settings->Devices" section. This is a unique value per device.
RFID::Scan Method
Description: Authenticates a scanned RFID against the user's friend listMethod: POST
Required Parameters:
- key
- device_id (int)
- rfid string (12 chars)
Sample Request:
POST /rfid/scan?key=awajkca0u09wnmawd808nmhawdanbcw1&device_id=1&rfid=13004C8ED311 HTTP/1.1
Host: api.mykegerator.net
Host: api.mykegerator.net
Sample Response:
HTTP/1.1 200 OK
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"Success","action":"unlock","first_name":"Test","last_name":"User","email":"test@test.com","rfid":"13004C8ED311"}
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"Success","action":"unlock","first_name":"Test","last_name":"User","email":"test@test.com","rfid":"13004C8ED311"}
Returned JSON Parameters:
- status (200|500)
- result Success|Failure
- action unauthorized|unlock
- first_name Friend's first name
- last_name Friend's last name
- email Friend's email address
- rfid Friend's RFID badge #
Additional Request Information
device_id - This parameter is required. This value can be determined by the "Device ID" listed in your "Account Settings->Devices" section. This is a unique value per device.
rfid - This parameter is required. This is a unique 12-character string that is assigned to the friend's RFID card. This can be found by scanning the RFID card, and then visiting the "Recent Activity" section of the Control Panel.
Sensor::Add Method
Description: Adds a new sensor reading to the Kegerator.Method: POST
Required Parameters:
- key
- device_id (int)
- sensor_id (float)
- value (int)
Sample Request:
POST /sensor/add?key=awajkca0u09wnmawd808nmhawdanbcw1&device_id=1&sensor_id=2&value=36.40
Host: api.mykegerator.net
Host: api.mykegerator.net
Sample Response:
HTTP/1.1 200 OK
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"success","sensor_id":"2","sensor_value":"36.40","units":"F"}
Date: Sat, 28 Jul 2012 18:30:36 GMT
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 28 Jul 2012 18:30:36 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
{"status":"200","result":"success","sensor_id":"2","sensor_value":"36.40","units":"F"}
Returned JSON Parameters:
- status
- result (200|500)
- sensor_id (int)
- sensor_value (float)
- units (F|C)
Additional Request Information
device_id - This parameter is required. This value can be determined by the "Device ID" listed in your "Account Settings->Devices" section. This is a unique value per device.
sensor_id - This parameter is required. This value can be determined by the "Sensor ID" value listed next to each sensor in your "Account Settings->Devices->Sensors" section. This is a unique value per sensor.