Methods
delete(uri) → {Promise.<any>}
Perform a DELETE request.
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to /api. |
Returns:
- Type:
-
Promise.<any>
get(uri) → {Promise.<any>}
Perform a GET request.
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to /api. |
Returns:
- Type:
-
Promise.<any>
getApi(uri) → {Api}
Create an Api instance, to receive realtime events.
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The URI of the endpoint, e.g. |
Returns:
- Type:
-
Api
getApiApp(appId) → {Api}
Create an ApiApp instance, to receive realtime events.
Parameters:
Name | Type | Description |
---|---|---|
appId |
string
|
The ID of the App, e.g. |
Returns:
- Type:
-
Api
(async) getLocalUrl() → {Promise.<string>}
Returns the url for local access.
Requires the
homey:manager:api
permission. For more information about permissions read the Permissions tutorial.
Returns:
- Type:
-
Promise.<string>
(async) getOwnerApiToken() → {Promise.<string>}
Starts a new API session on behalf of the homey owner and returns the API token. The API Token expires after not being used for two weeks.
Requires the
homey:manager:api
permission. For more information about permissions read the Permissions tutorial.
Returns:
- Type:
-
Promise.<string>
post(uri, body) → {Promise.<any>}
Perform a POST request.
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to /api. |
body |
any
|
The body of the request. |
Returns:
- Type:
-
Promise.<any>
put(uri, body) → {Promise.<any>}
Perform a PUT request.
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to /api. |
body |
any
|
The body of the request. |
Returns:
- Type:
-
Promise.<any>
realtime(event, data)
Emit a realtime
event.
Parameters:
Name | Type | Description |
---|---|---|
event |
string
|
The name of the event |
data |
any
|
The data of the event |