Domoio API

Authentication

The first step to use the api key is get your api_key and api_secret. Visit https://domoio.com/users/edit and open the tab API Access. If you click the button GENERATE NEW API KEYS you will get your API Key and API Secret. The API Secret will only be visible when you create it. You can request a new API Secret by clicking on the button GENERATE NEW API KEYS again.

Now you have your API Key and API Secret, you can create a new session

curl -H "Content-Type: application/json" -X POST -d '{"api_key": "bb829162-0408-4e77-83db-e233ec31cdb6", "api_secret": "4a838536e939ce3b9bd3f3311806f5c3"}' https://app.domoio.com/api/get_token

If the API Key and API Secret are correct, the server will respond with something like this:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uX2lkIjoiODlmYWJjMTItOWVkZi00NDQxLTlmNjgtMGUxMWRkYTc4ZDQ4IiwidG9rZW4iOiI3OWIxNGM2NDc2NDViYWRmMzY0OWY0YzA1OGIxZjc5NTEwMzVjOWI1ZmZiNyIsInVzZXJfaWQiOiJlOWM3ZjYwZi1jMjNlLTQxNDktYmVjNC0yMmU5NmE4NjQ1MTkifQ.XTYdNVTjCTFQz0Cmi4sACk48QKCfqgq-GCutvmglpxg",
  "session_id": "89fabc12-9edf-4441-9f68-0e11dda78d48"
}

Now on, you will use the token to authenticate with the sever. Any request must include a header with name authtoken

curl -H "authtoken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uX2lkIjoiODlmYWJjMTItOWVkZi00NDQxLTlmNjgtMGUxMWRkYTc4ZDQ4IiwidG9rZW4iOiI3OWIxNGM2NDc2NDViYWRmMzY0OWY0YzA1OGIxZjc5NTEwMzVjOWI1ZmZiNyIsInVzZXJfaWQiOiJlOWM3ZjYwZi1jMjNlLTQxNDktYmVjNC0yMmU5NmE4NjQ1MTkifQ.XTYdNVTjCTFQz0Cmi4sACk48QKCfqgq-GCutvmglpxg" https://app.domoio.com/api/projects

API Endpoints

POST /api/get_token

Creates a session and returns session id just created and a token for authenticate the requests.

Parameters

Response

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uX2lkIjoiODlmYWJjMTItOWVkZi00NDQxLTlmNjgtMGUxMWRkYTc4ZDQ4IiwidG9rZW4iOiI3OWIxNGM2NDc2NDViYWRmMzY0OWY0YzA1OGIxZjc5NTEwMzVjOWI1ZmZiNyIsInVzZXJfaWQiOiJlOWM3ZjYwZi1jMjNlLTQxNDktYmVjNC0yMmU5NmE4NjQ1MTkifQ.XTYdNVTjCTFQz0Cmi4sACk48QKCfqgq-GCutvmglpxg",
  "session_id": "89fabc12-9edf-4441-9f68-0e11dda78d48"
}

GET /api/projects

Returns the list of projects

Response

[
  {
    "user": {
      "name": "Jhon Doe",
      "id": "e9c7f60f-c23e-4149-bec4-22e96a864519",
      "email": "jhon.doe@example.com"
    },
    "role": "admin",
    "name": "Mi Hogar",
    "id": "6b90a926-6d35-47e3-8b50-30690b69e5c5",
    "dashboard_id": "47889e58-0175-48be-868d-fdccd3152719",
    "confirmed": true,
    "auto_dashboard": false
  },
  {
    "user": {
      "name": "Jhon Doe",
      "id": "e9c7f60f-c23e-4149-bec4-22e96a864519",
      "email": "jhon.doe@example.com"
    },
    "role": "admin",
    "name": "My Home",
    "id": "ea739a8c-f86b-4e13-88ec-83ecd8dd6014",
    "dashboard_id": "ab72f41d-b687-49da-9642-cea1a6edbb34",
    "confirmed": true,
    "auto_dashboard": true
  }
]

GET /api/projects/${project_id}/dashboard

Returns information about the default dashboard for the given project.

Response

{
  "views": {
    "58f056c1-bdb3-483a-a073-ab33d0e5476c": {
      "name": "My Home",
      "id": "58f056c1-bdb3-483a-a073-ab33d0e5476c",
      "groups": [
        {
          "position": "main",
          "name": null,
          "id": "954e0f25-e31b-428a-bcaa-e119620fa34d",
          "components": [
            {
              "state_port": "100",
              "push": "100",
              "name_source": "component",
              "name": "Living Room Lamp",
              "key": "74b8fdc3-1c34-4804-abba-5f9bdf0a8433::watering_ctrl",
              "id": "watering_ctrl",
              "icon": "snfss",
              "device_id": "74b8fdc3-1c34-4804-abba-5f9bdf0a8433",
              "controller": "switch",
              "config": {
                "ports": null
              },
              "avatar": "light"
            },
            {
              "state_port": "out",
              "push": "in",
              "name_source": "device",
              "name": "Living Room Fan ",
              "key": "26e42ca0-5044-4538-861e-b1b313b215dc::button",
              "id": "button",
              "icon": "switch",
              "device_id": "26e42ca0-5044-4538-861e-b1b313b215dc",
              "controller": "switch",
              "config": {
                "components": []
              },
              "avatar": "cooler"
            },
            {
              "state_port": "out",
              "push": "in",
              "name_source": "device",
              "name": "Kitchen Plug",
              "key": "f8869f3f-2577-4deb-9df6-881ac0eca4f0::button",
              "id": "button",
              "icon": "switch",
              "device_id": "f8869f3f-2577-4deb-9df6-881ac0eca4f0",
              "controller": "switch",
              "config": {
                "components": []
              },
              "avatar": null
            },
            {
              "state_port": "out",
              "push": "in",
              "name_source": "device",
              "name": "Rosebush Lamp",
              "key": "8ffc6749-f8aa-412e-8bef-a44b0a679210::button",
              "id": "button",
              "icon": "switch",
              "device_id": "8ffc6749-f8aa-412e-8bef-a44b0a679210",
              "controller": "switch",
              "config": {
                "components": []
              },
              "avatar": "plants"
            },
            {
              "state_port": "out",
              "push": "in",
              "name_source": "device",
              "name": "Backyard Light",
              "key": "48874b1c-6e9d-4bb7-b74d-dd79e0114ba9::button",
              "id": "button",
              "icon": "switch",
              "device_id": "48874b1c-6e9d-4bb7-b74d-dd79e0114ba9",
              "controller": "switch",
              "config": {
                "components": []
              },
              "avatar": "light"
            },
            {
              "state_port": "out",
              "push": "in",
              "name_source": "device",
              "name": "Garden Lights",
              "key": "f31e7667-6000-4489-8666-fce0850736c5::button",
              "id": "button",
              "icon": "switch",
              "device_id": "f31e7667-6000-4489-8666-fce0850736c5",
              "controller": "switch",
              "config": {
                "components": []
              },
              "avatar": "light"
            },
            {
              "state_port": "out",
              "push": "in",
              "name_source": "device",
              "name": "Timer",
              "key": "abfa3688-dd70-4e7f-8070-fe63c2e260e7::button",
              "id": "button",
              "icon": "timer",
              "device_id": "abfa3688-dd70-4e7f-8070-fe63c2e260e7",
              "controller": "timer_switch",
              "config": {
                "unit": "seconds",
                "duration": 4,
                "components": []
              },
              "avatar": null
            }
          ],
          "component_ids": [
            {
              "ui_id": "watering_ctrl",
              "device_id": "74b8fdc3-1c34-4804-abba-5f9bdf0a8433"
            },
            {
              "ui_id": "button",
              "device_id": "26e42ca0-5044-4538-861e-b1b313b215dc"
            },
            {
              "ui_id": "button",
              "device_id": "f8869f3f-2577-4deb-9df6-881ac0eca4f0"
            },
            {
              "ui_id": "button",
              "device_id": "8ffc6749-f8aa-412e-8bef-a44b0a679210"
            },
            {
              "ui_id": "button",
              "device_id": "48874b1c-6e9d-4bb7-b74d-dd79e0114ba9"
            },
            {
              "ui_id": "button",
              "device_id": "f31e7667-6000-4489-8666-fce0850736c5"
            },
            {
              "ui_id": "button",
              "device_id": "abfa3688-dd70-4e7f-8070-fe63c2e260e7"
            }
          ]
        }
      ]
    }
  },
  "name": null,
  "id": null,
  "empty": false,
  "auto_generated": true
}

GET /api/projects/${project_id}/state

Return information about the state of the project devices and ports.

Response

{
  "device_states": {
    "f8869f3f-2577-4deb-9df6-881ac0eca4f0": {
      "ports": {
        "out": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "in": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "f8869f3f-2577-4deb-9df6-881ac0eca4f0",
      "firmware": null,
      "connected": false
    },
    "f31e7667-6000-4489-8666-fce0850736c5": {
      "ports": {
        "out": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "in": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "f31e7667-6000-4489-8666-fce0850736c5",
      "firmware": null,
      "connected": false
    },
    "b65dbb19-5a61-4d27-9571-36042cc7820a": {
      "ports": {
        "out": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        }
      },
      "id": "b65dbb19-5a61-4d27-9571-36042cc7820a",
      "firmware": null,
      "connected": false
    },
    "abfa3688-dd70-4e7f-8070-fe63c2e260e7": {
      "ports": {
        "out": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "in": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "abfa3688-dd70-4e7f-8070-fe63c2e260e7",
      "firmware": null,
      "connected": false
    },
    "8ffc6749-f8aa-412e-8bef-a44b0a679210": {
      "ports": {
        "out": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "in": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "8ffc6749-f8aa-412e-8bef-a44b0a679210",
      "firmware": null,
      "connected": false
    },
    "74b8fdc3-1c34-4804-abba-5f9bdf0a8433": {
      "ports": {
        "5": {
          "scheduled_action": null,
          "value": 0,
          "type": "analogic",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "4": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "14": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "12": {
          "scheduled_action": null,
          "value": 1,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "100": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        }
      },
      "id": "74b8fdc3-1c34-4804-abba-5f9bdf0a8433",
      "firmware": null,
      "connected": false
    },
    "48874b1c-6e9d-4bb7-b74d-dd79e0114ba9": {
      "ports": {
        "out": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "in": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "48874b1c-6e9d-4bb7-b74d-dd79e0114ba9",
      "firmware": null,
      "connected": false
    },
    "4641c736-c73c-4a6c-a1f1-bd6eeccec3bb": {
      "ports": {
        "1": {
          "scheduled_action": null,
          "value": 0,
          "type": "data",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "4641c736-c73c-4a6c-a1f1-bd6eeccec3bb",
      "firmware": null,
      "connected": false
    },
    "26e42ca0-5044-4538-861e-b1b313b215dc": {
      "ports": {
        "out": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "in": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "26e42ca0-5044-4538-861e-b1b313b215dc",
      "firmware": null,
      "connected": false
    },
    "015fcabe-990e-42f1-b235-fa73632dbc8a": {
      "ports": {
        "2": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "output",
          "controller": null
        },
        "1": {
          "scheduled_action": null,
          "value": 0,
          "type": "digital",
          "notify_changes": true,
          "io": "input",
          "controller": null
        }
      },
      "id": "015fcabe-990e-42f1-b235-fa73632dbc8a",
      "firmware": null,
      "connected": false
    }
  },
  "alerts": [
    {
      "topic": "device_disconnected",
      "project_id": "ea739a8c-f86b-4e13-88ec-83ecd8dd6014",
      "name": "CoffeeMaker",
      "meta": {
        "name": "CoffeeMaker"
      },
      "id": "3562d5bc-cf75-4078-9ba1-8a27813c2a64",
      "device_id": "74b8fdc3-1c34-4804-abba-5f9bdf0a8433",
      "date": "2018-05-16T17:31:59.883Z",
      "ack": true
    },
    {
      "topic": "device_disconnected",
      "project_id": "ea739a8c-f86b-4e13-88ec-83ecd8dd6014",
      "name": "CoffeeMaker",
      "meta": {
        "name": "CoffeeMaker"
      },
      "id": "5616a8b7-3697-4ec4-9691-2d0cd05c0652",
      "device_id": "74b8fdc3-1c34-4804-abba-5f9bdf0a8433",
      "date": "2018-05-16T16:14:42.759Z",
      "ack": true
    },
    {
      "topic": "device_disconnected",
      "project_id": "ea739a8c-f86b-4e13-88ec-83ecd8dd6014",
      "name": "My orbiter",
      "meta": {
        "name": "My orbiter"
      },
      "id": "88e6c776-d785-46a1-a125-763b9624c047",
      "device_id": "015fcabe-990e-42f1-b235-fa73632dbc8a",
      "date": "2018-05-16T16:14:42.751Z",
      "ack": true
    },
    {
      "topic": "device_disconnected",
      "project_id": "ea739a8c-f86b-4e13-88ec-83ecd8dd6014",
      "name": "My orbiter",
      "meta": {
        "name": "My orbiter"
      },
      "id": "9cce6563-1cf9-46ee-9558-4710845da2b6",
      "device_id": "015fcabe-990e-42f1-b235-fa73632dbc8a",
      "date": "2018-05-18T09:15:28.297Z",
      "ack": true
    }
  ]
}

PUT /api/projects/\({project_id}/devices/\){device_id}/ports/${port_id}

Change port states.

Parameters

  • value: New state. It can be 1 or 0 for digital ports, any integer for analog ports, or json data for data ports.

Response

{status: 'ok'}

Real Time Notifications

If you want to receive real times notifications about port state changes, device connection state changes or other topics, you can subscribe using WebSockets and this url:

wss://app.domoio.com/socket?token=${API_TOKEN}