Has anybody used a HTTP Patch request in a binding?
The API I’m working with uses a PATCH method to submit updates rather than a POST which I’d have expected. To implement this I’m trying to import the Apache client class.
In my manifest I add the following:
org.apache.http.client,
org.apache.http.client.methods,
org.apache.http.entity,
org.apache.http,
org.apache.http.impl.client,
And my method looks like this:
CloseableHttpClient http = HttpClientBuilder.create().build();
String payload = "{\"RequestOverride\":{\"Type\":\"Manual\",\"SetPoint\":165}}";
HttpPatch updateRequest = new HttpPatch("http://192.168.3.6/data/domain/Room/1");
updateRequest.setEntity(new StringEntity(payload, ContentType.APPLICATION_JSON));
HttpResponse response = http.execute(updateRequest);
It compiles fine, but at run time I see this in the console:
!ENTRY org.eclipse.osgi 4 0 2017-11-10 22:52:38.172
!MESSAGE Bundle initial@reference:file:../../../../../git/openhab2-addons/addons/binding/org.openhab.binding.draytonwiser/ was not resolved.
!ENTRY org.eclipse.osgi 4 0 2017-11-10 22:52:38.184
!MESSAGE Bundle initial@reference:file:plugins/org.apache.httpcomponents.httpclient_4.5.2.v20170210-0925.jar was not resolved.
Do I need to add a .jar somewhere? Is there a better way to implement a patch method?
Thanks in advance!