Open API Interface

Instruction

iHost offers a set of open API documents for you to develop your add-on or integrate iHost into the third-party home automation system. iHost is fully under the control to obtain device information and control the device by calling an HTTP API request.

Start to Use

Get started

Hardware Function

Restart Gateway

Allow authorized user to restart the gateway through this interface

  • URL?/open-api/v1/rest/hardware/reboot
  • Method?POST
  • Header?
    • Content-Type: application/json
    • Autorization: Bearer <token>

Request Parameters: none
Successful data response: empty Object {}

Conditions: The request parameters are legal, and the user identity verification is passed.

Status Code: 200 OK

{
"error": 0,
"data": {},
"message": "success"
}

Speaker Control

Allow authorized users to control the speaker through this interface

  • URL?/open-api/v1/rest/hardware/speaker
  • Method?POST
  • Header?
    • Content-Type: application/json
    • Authorization: Bearer <token>
Request parameters

Attribute

Type

Optional

Description

type

string

N

Optional parameters: 1.play_sound (play the sound) 2.play_beep (play the beep)

sound

SoundObject

Y (N if type is play_sound.)

The sound.

beep

BeepObject

Y (N if type is play_beep.)

The beep

SoundObject Object

Attribute

Type

Optional

Description

name

string

N

The sound name. The supported values can be checked in [Resource List – Supported sound]

volume

int

N

The sound volume. [0-100]

countdown

int

N

The duration for the speaker to play the sound, and it will stop playing automatically after the time is up. Unit: second. [0,1799]

Conditions: The request parameters are legal, and the user identity verification is passed.
Status Code: 200 OK
BeepObject Object

Attribute

Type

Optional

Description

name

string

N

The deep name. The supported values can be checked in [Resource List – Supported deep]

volume

int

N

The deep volume. [0-100]

Successful data response: empty Object {}
Conditions: The request parameters are legal, and the user identity verification is passed.
Status Code: 200 OK

Response Example:

{
"error": 0,
"data": {},
"message": "success"
}

Open API Document

 

Check the below link to learn more details about WEB API, Third-party Device Access, Server-sent events, and so on.

https://ewelink.cc/ewelink-cube/open-api/

Pin It on Pinterest