Skip to content

REST API documentation

Bernard edited this page Jun 19, 2017 · 18 revisions

REST api

How to use

Python

Minimal GET example >>> import requests >>> r = requests.get('https://localhost:18081/service/ReadSettings', auth=('cooler','ChangeMe!'), verify=False) C:\Users\Bernard\VE\cryostat\lib\site-packages\urllib3\connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warningsInsecureRequestWarning) >>> r.json() [1.4, 2, 3, 4, 70, 50, 14, 12, 50, 4.4, 2, 20, 2.5, 30, 0.05]

Minimal POST example

r = requests.post('https://localhost:18081/service/Cooldown', auth=('cooler','ChangeMe!'), verify=False)

Requests are made over a secure connection, but if the certificate is not signed with a CA authorety, requests will throw errors when connecting. Either set verify=False to disable the check, or make sure that the server certificate is trusted by the pc.

list of commands

The REST commands are defined in: https://github.com/BBekker/CryostatControl/blob/dev/CryostatControlServer/HostService/ICommandService.cs

  • HTTPS://<address>:18081/service/ Main address
    • GET IsAlive check server alive, returns true
    • POST Cooldown start a cooldown now
    • POST CooldownTime Start the cooldown at a time set in the request body. formatted in microsofts own strange format: \/Date(<miliseconds since 1970-01-01 00:00>)\/
    • POST Recycle
    • POST RecycleTime
    • POST Warmup
    • POST WarmupTime
    • POST Manual
    • POST Cancel
    • GET GetState
    • GET GetStartTime
    • POST SetCompressorState
    • POST WriteHelium7 Write a value to a heater. body must be of format: { 'heater':<id> , 'value':<value in volts>}
    • GET GetValue/<sensor id> read a sensor. list of ids
    • GET ReadSettings returns an array of all settings ordered according to SettingEnumerator
    • POST WriteSettingValue change a setting on the server, body must be of the format: { 'setting':<setting id>, 'value':<new value}
    • POST StartLogging { 'interval', <integer interval>, 'logData':<array of true/false values>}
    • POST CancelLogging
    • GET IsLogging
Clone this wiki locally