You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››

Homey.ManagerApi

const { ManagerApi } = require('homey');

Table of Contents

Methods

delete(path, body, callbackopt)

Perform a DELETE request.

Parameters:
Name Type Attributes Description
path string

The full path of the request, relative to /api.

body *

The body of the request.

callback genericCallbackFunction <optional>
Returns:

Promise

get(path, callbackopt)

Perform a GET request.

Parameters:
Name Type Attributes Description
path string

The full path of the request, relative to /api.

callback genericCallbackFunction <optional>
Returns:

Promise

getApi(uri)

Get an Api instance.

Parameters:
Name Type Description
uri string
Returns:

Api

getLocalUrl(callbackopt)

Returns the url for local access. Requires the homey:manager:api permission

Parameters:
Name Type Attributes Description
callback genericCallbackFunction <optional>
Returns:

Promise

getOwnerApiToken(callbackopt)

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

Parameters:
Name Type Attributes Description
callback genericCallbackFunction <optional>
Returns:

Promise

post(path, body, callbackopt)

Perform a POST request.

Parameters:
Name Type Attributes Description
path string

The full path of the request, relative to /api.

body *

The body of the request.

callback genericCallbackFunction <optional>
Returns:

Promise

put(path, body, callbackopt)

Perform a PUT request.

Parameters:
Name Type Attributes Description
path string

The full path of the request, relative to /api.

body *

The body of the request.

callback genericCallbackFunction <optional>
Returns:

Promise

realtime(event, data)

Emit a realtime event.

Parameters:
Name Type Description
event string

The name of the event

data *

The data of the event

registerApi(api)

Register an Api instance, to receive realtime events.

Parameters:
Name Type Description
api Api
Returns:

Api

unregisterApi(api)

Unregister an Api instance.

Parameters:
Name Type Description
api Api