API Documentation V1

Public API documentation Version 1.

Before You Begin

Making the requests described here exposes the system you are connecting to, so credentials and tokens must be stored securely.

Obtain Session Token

POST https://api.ohmautomation.io/control/v1/auth

This endpoint allows you to obtain the session token required to make all other requests.

Headers

Name
Type
Description

Content-Type

string

application/json

Request Body

Name
Type
Description

username*

string

Username

password*

string

User password

{
  "token": "r:qwertyuiop1234567890"
}

Delete Session

POST https://api.ohmautomation.io/control/v1/logout

This endpoint allows you to delete the session, making the token unusable.

Headers

Name
Type
Description

X-Session-Token*

string

Session token to be deleted

{
  "token": <deleted_token>
}

Shortcuts JSON

GET https://api.ohmautomation.io/control/v1/shortcuts?token=abc

This endpoint retrieves a JSON with the user’s shortcut configuration corresponding to the token.

Query Parameters

Name
Type
Description

token*

string

Session token

{
    "shortcuts": [
        {
            "askConfirm": false,
            "category": "shortcut",
            "color": "#117ED9",
            "desc": "Turn off all lights",
            "icon": "house_2",
            "id": "abc123",
            "itemACL": [
                {
                    "id": "qwerty",
                    "read": true,
                    "write": true
                }
            ],
            "name": "Demo",
            "objectId": "system",
            "operations": [
                {
                    "function": {
                        "args": {},
                        "name": "turn_off_all_lights"
                    },
                    "objectId": "system",
                    "timer": {
                        "days": 0,
                        "hours": 0,
                        "min": 0,
                        "sec": 0
                    }
                }
            ],
            "parameters": []
        },
        {
            "askConfirm": false,
            "category": "shortcut",
            "color": "#FFB300",
            "desc": "Toggle TV",
            "icon": "tv",
            "id": "abc1234",
            "itemACL": [
                {
                    "id": "qwerty",
                    "read": true,
                    "write": true
                }
            ],
            "name": "TV",
            "objectId": "ac278aa6-fdd8-4899-960e-55ad702452ce",
            "operations": [
                {
                    "function": {
                        "args": {},
                        "name": "toggle"
                    },
                    "objectId": "ac278aa6-fdd8-4899-960e-55ad702452ce",
                    "timer": {
                        "days": 0,
                        "hours": 0,
                        "min": 0,
                        "sec": 0
                    }
                }
            ],
            "parameters": []
        },
        {
            "askConfirm": false,
            "category": "shortcut",
            "color": "#880E4F",
            "desc": "Open/Close gate",
            "icon": "gate",
            "id": "abc12345",
            "itemACL": [
                {
                    "id": "qwerty",
                    "read": true,
                    "write": true
                }
            ],
            "name": "Gate",
            "objectId": "",
            "operations": [
                {
                    "function": {
                        "args": {},
                        "name": "on"
                    },
                    "objectId": "a41f6a53-3b69-44e4-abf2-fed4bed8785c",
                    "timer": {
                        "days": 0,
                        "hours": 0,
                        "min": 0,
                        "sec": 0
                    }
                }
            ],
            "parameters": []
        }
    ]
}

It is possible to avoid using the token in the URL by attaching it to the Headers.

Shortcuts JSON with Headers

GET https://api.ohmautomation.io/control/v1/shortcuts

As with the previous method, this also retrieves a JSON with the shortcut configuration, but the token is indicated in the Headers. We recommend this approach since it doesn't expose the token in the URL.

Headers

Name
Type
Description

Content-Type

string

application/json

X-Session-Token*

string

Session token

{
    "shortcuts": [
        {
            "askConfirm": false,
            "category": "shortcut",
            "color": "#117ED9",
            "desc": "Turn off all lights",
            "icon": "house_2",
            "id": "abc123",
            "itemACL": [
                {
                    "id": "qwerty",
                    "read": true,
                    "write": true
                }
            ],
            "name": "Demo",
            "objectId": "system",
            "operations": [
                {
                    "function": {
                        "args": {},
                        "name": "turn_off_all_lights"
                    },
                    "objectId": "system",
                    "timer": {
                        "days": 0,
                        "hours": 0,
                        "min": 0,
                        "sec": 0
                    }
                }
            ],
            "parameters": []
        },
        {
            "askConfirm": false,
            "category": "shortcut",
            "color": "#FFB300",
            "desc": "Toggle TV",
            "icon": "tv",
            "id": "abc1234",
            "itemACL": [
                {
                    "id": "qwerty",
                    "read": true,
                    "write": true
                }
            ],
            "name": "TV",
            "objectId": "ac278aa6-fdd8-4899-960e-55ad702452ce",
            "operations": [
                {
                    "function": {
                        "args": {},
                        "name": "toggle"
                    },
                    "objectId": "ac278aa6-fdd8-4899-960e-55ad702452ce",
                    "timer": {
                        "days": 0,
                        "hours": 0,
                        "min": 0,
                        "sec": 0
                    }
                }
            ],
            "parameters": []
        },
        {
            "askConfirm": false,
            "category": "shortcut",
            "color": "#880E4F",
            "desc": "Open/Close gate",
            "icon": "gate",
            "id": "abc12345",
            "itemACL": [
                {
                    "id": "qwerty",
                    "read": true,
                    "write": true
                }
            ],
            "name": "Gate",
            "objectId": "",
            "operations": [
                {
                    "function": {
                        "args": {},
                        "name": "on"
                    },
                    "objectId": "a41f6a53-3b69-44e4-abf2-fed4bed8785c",
                    "timer": {
                        "days": 0,
                        "hours": 0,
                        "min": 0,
                        "sec": 0
                    }
                }
            ],
            "parameters": []
        }
    ]
}

Execute Shortcut

POST https://api.ohmautomation.io/control/v1/shortcut

Headers

Name
Type
Description

Content-Type

string

application/json

X-Session-Token*

string

Session token

Request Body

Name
Type
Description

id*

string

Shortcut ID

command*

string

run

View Shortcut via Web

GET https://api.ohmautomation.io/control/v1/shortcut?token=abc&link=0&lang=it

This endpoint allows viewing and executing a shortcut.

Query Parameters

Name
Type
Description

token*

string

Session token

id*

string

Shortcut ID

lang

string

Display language (en by default)

HTML

Last updated