public class DeviceOperations extends Object
| Constructor and Description |
|---|
DeviceOperations() |
| Modifier and Type | Method and Description |
|---|---|
static HttpResponse |
request(IotHubConnectionString iotHubConnectionString,
URL url,
HttpMethod method,
byte[] payload,
String requestId,
long timeoutInMs)
Send a http request to the IoTHub using the Twin/Method standard, and return its response.
|
static void |
setHeaders(Map<String,String> httpHeaders)
Sets headers to be used on next HTTP request
|
public static HttpResponse request(IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, byte[] payload, String requestId, long timeoutInMs) throws IOException, IotHubException, IllegalArgumentException
iotHubConnectionString - is the connection string for the IoTHuburl - is the Twin URL for the device ID.method - is the HTTP method (GET, POST, DELETE, PATCH, PUT).payload - is the array of bytes that contains the payload.requestId - is an unique number that identify the request.timeoutInMs - is timeout in milliseconds.IotHubException - This exception is thrown if the response verification failedIOException - This exception is thrown if the IO operation failedIllegalArgumentExceptionpublic static void setHeaders(Map<String,String> httpHeaders) throws IllegalArgumentException
httpHeaders - non null and non empty custom headersIllegalArgumentException - This exception is thrown if headers were null or emptyCopyright © 2017. All rights reserved.