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,
int connectTimeout,
int readTimeout,
Proxy proxy)
Send a http request to the IoTHub using the Twin/Method standard, and return its response.
|
static HttpResponse |
request(IotHubConnectionString iotHubConnectionString,
URL url,
HttpMethod method,
byte[] payload,
String requestId,
long timeoutInMs)
Deprecated.
|
static HttpResponse |
request(String credentialToken,
URL url,
HttpMethod method,
byte[] payload,
String requestId,
int connectTimeout,
int readTimeout,
Proxy proxy)
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.
|
@Deprecated public static HttpResponse request(IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, byte[] payload, String requestId, long timeoutInMs) throws IOException, IotHubException, IllegalArgumentException
request(IotHubConnectionString, URL, HttpMethod, byte[], String, int, int, Proxy) instead.iotHubConnectionString - is the connection string for the IoTHub.url - 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 failed.IOException - This exception is thrown if the IO operation failed.IllegalArgumentExceptionpublic static HttpResponse request(IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, byte[] payload, String requestId, int connectTimeout, int readTimeout, Proxy proxy) throws IOException, IotHubException, IllegalArgumentException
iotHubConnectionString - is the connection string for the IoTHub.url - 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.connectTimeout - the http connect timeout to use, in milliseconds.readTimeout - the http read timeout to use, in milliseconds.proxy - the proxy to use, or null if no proxy will be used.IotHubException - This exception is thrown if the response verification failed.IOException - This exception is thrown if the IO operation failed.IllegalArgumentExceptionpublic static HttpResponse request(String credentialToken, URL url, HttpMethod method, byte[] payload, String requestId, int connectTimeout, int readTimeout, Proxy proxy) throws IOException, IotHubException, IllegalArgumentException
credentialToken - The authentication token that will be used to authorize the requesturl - 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.connectTimeout - the http connect timeout to use, in milliseconds.readTimeout - the http read timeout to use, in milliseconds.proxy - the proxy to use, or null if no proxy will be used.IotHubException - This exception is thrown if the response verification failed.IOException - This exception is thrown if the IO operation failed.IllegalArgumentExceptionpublic static void setHeaders(Map<String,String> httpHeaders) throws IllegalArgumentException
httpHeaders - non null and non empty custom headers.IllegalArgumentException - This exception is thrown if headers were null or empty.Copyright © 2022. All rights reserved.