Request to send a local device command over HTTP. Commands are sent to the device using DeviceManager.send.

Example GET request:

const command = new DataFlow.HttpRequestData();
command.requestId = request.requestId;
command.deviceId = 'device-id';
command.method = Constants.HttpOperation.GET;
command.port = 80;
command.path = '/endpoint/control?state=on';

Example POST request:

const postData = {
  on: true,
};

const command = new DataFlow.HttpRequestData();
command.requestId = request.requestId;
command.deviceId = 'device-id';
command.method = Constants.HttpOperation.POST;
command.port = 80;
command.path = '/endpoint/control';
command.dataType = 'application/json';
command.data = JSON.stringify(postData);

Implements

Implemented by

Index

Properties

data

data: string

Payload sent to the target device

dataType

dataType: string

HTTP Content-Type header

deviceId

deviceId: string

Device ID of the target device.

headers

headers: string

List of HTTP headers for the request

method

HTTP method to perform

path

path: string

URI path on the target device

Optional port

port: undefined | number

Port number on the target device. Default is port 80.

protocol

protocol: Protocol

Protocol to use when sending this command

requestId

requestId: string

Request ID from the associated EXECUTE intent.