diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java
index 1694d2a..f5835dc 100644
--- a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java
@@ -16,13 +16,15 @@
 
 package org.onosproject.protocol.http;
 
+import java.io.InputStream;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+
 import org.onlab.packet.IpAddress;
 import org.onosproject.net.DeviceId;
 import org.onosproject.protocol.rest.RestSBDevice;
 
-import java.io.InputStream;
-import java.util.Map;
-
 /**
  * Abstraction of an HTTP controller. Serves as a one stop shop for obtaining
  * HTTP southbound devices and (un)register listeners.
@@ -47,7 +49,7 @@
     /**
      * Returns a device by Ip and Port.
      *
-     * @param ip   device ip
+     * @param ip device ip
      * @param port device port
      * @return RestSBDevice rest device
      */
@@ -70,70 +72,154 @@
     /**
      * Does a HTTP POST request with specified parameters to the device.
      *
-     * @param device    device to make the request to
-     * @param request   url of the request
-     * @param payload   payload of the request as an InputStream
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
      * @param mediaType type of content in the payload i.e. application/json
      * @return true if operation returned 200, 201, 202, false otherwise
+     *
+     * @deprecated in Kingfisher (1.10.0)
      */
+    @Deprecated
     boolean post(DeviceId device, String request, InputStream payload, String mediaType);
 
     /**
      * Does a HTTP POST request with specified parameters to the device.
      *
-     * @param <T>           post return type
-     * @param device        device to make the request to
-     * @param request       url of the request
-     * @param payload       payload of the request as an InputStream
-     * @param mediaType     type of content in the payload i.e. application/json
+     * @param <T> post return type
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
      * @param responseClass the type of response object we are interested in,
-     *                      such as String, InputStream.
+     *            such as String, InputStream.
      * @return Object of type requested via responseClass.
      */
-    <T> T post(DeviceId device, String request, InputStream payload,
-               String mediaType, Class<T> responseClass);
+    @Deprecated
+    <T> T post(DeviceId device, String request, InputStream payload, String mediaType, Class<T> responseClass);
 
     /**
      * Does a HTTP PUT request with specified parameters to the device.
      *
-     * @param device    device to make the request to
-     * @param request   resource path of the request
-     * @param payload   payload of the request as an InputStream
+     * @param device device to make the request to
+     * @param request resource path of the request
+     * @param payload payload of the request as an InputStream
      * @param mediaType type of content in the payload i.e. application/json
      * @return true if operation returned 200, 201, 202, false otherwise
+     *
+     * @deprecated in Kingfisher (1.10.0)
      */
+    @Deprecated
     boolean put(DeviceId device, String request, InputStream payload, String mediaType);
 
     /**
+     *
      * Does a HTTP GET request with specified parameters to the device.
      *
-     * @param device    device to make the request to
-     * @param request   url of the request
+     * @param device device to make the request to
+     * @param request url of the request
      * @param mediaType format to retrieve the content in
      * @return an inputstream of data from the reply.
      */
+    @Deprecated
     InputStream get(DeviceId device, String request, String mediaType);
 
     /**
      * Does a HTTP PATCH request with specified parameters to the device.
      *
-     * @param device    device to make the request to
-     * @param request   url of the request
-     * @param payload   payload of the request as an InputStream
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
      * @param mediaType format to retrieve the content in
      * @return true if operation returned 200, 201, 202, false otherwise
+     *
+     * @deprecated in Kingfisher (1.10.0)
      */
+    @Deprecated
     boolean patch(DeviceId device, String request, InputStream payload, String mediaType);
 
     /**
      * Does a HTTP DELETE request with specified parameters to the device.
      *
-     * @param device    device to make the request to
-     * @param request   url of the request
-     * @param payload   payload of the request as an InputStream
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
      * @param mediaType type of content in the payload i.e. application/json
      * @return true if operation returned 200 false otherwise
+     *
+     * @deprecated in Kingfisher (1.10.0)
      */
+    @Deprecated
     boolean delete(DeviceId device, String request, InputStream payload, String mediaType);
 
+    /**
+     * Does a HTTP POST request with specified parameters to the device.
+     *
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
+     * @return status Commonly used status codes defined by HTTP
+     */
+    int post(DeviceId device, String request, InputStream payload, MediaType mediaType);
+
+    /**
+     * Does a HTTP PUT request with specified parameters to the device.
+     *
+     * @param device device to make the request to
+     * @param request resource path of the request
+     * @param payload payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
+     * @return status Commonly used status codes defined by HTTP
+     */
+    int put(DeviceId device, String request, InputStream payload, MediaType mediaType);
+
+    /**
+     * Does a HTTP PATCH request with specified parameters to the device.
+     *
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
+     * @param mediaType format to retrieve the content in
+     * @return status Commonly used status codes defined by HTTP
+     */
+    int patch(DeviceId device, String request, InputStream payload, MediaType mediaType);
+
+    /**
+     * Does a HTTP DELETE request with specified parameters to the device.
+     *
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
+     * @return status Commonly used status codes defined by HTTP
+     */
+    int delete(DeviceId device, String request, InputStream payload, MediaType mediaType);
+
+    /**
+    *
+    * Does a HTTP GET request with specified parameters to the device.
+    *
+    * @param device device to make the request to
+    * @param request url of the request
+    * @param mediaType format to retrieve the content in
+    * @return an inputstream of data from the reply.
+    */
+    InputStream get(DeviceId device, String request, MediaType mediaType);
+
+    /**
+     * Does a HTTP POST request with specified parameters to the device.
+     *
+     * @param <T> post return type
+     * @param device device to make the request to
+     * @param request url of the request
+     * @param payload payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
+     * @param responseClass the type of response object we are interested in,
+     *            such as String, InputStream.
+     * @return Object of type requested via responseClass.
+     */
+     <T> T post(DeviceId device, String request, InputStream payload, MediaType mediaType, Class<T> responseClass);
+
+
 }
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
index b162b56..cf34a40 100644
--- a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/ctl/HttpSBControllerImpl.java
@@ -16,7 +16,30 @@
 
 package org.onosproject.protocol.http.ctl;
 
-import com.google.common.collect.ImmutableMap;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.Base64;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.http.client.methods.HttpPatch;
 import org.apache.http.conn.ssl.AllowAllHostnameVerifier;
@@ -32,35 +55,14 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Base64;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import com.google.common.collect.ImmutableMap;
 
 /**
  * The implementation of HttpSBController.
  */
 public class HttpSBControllerImpl implements HttpSBController {
 
-    private static final Logger log =
-            LoggerFactory.getLogger(HttpSBControllerImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(HttpSBControllerImpl.class);
     private static final String XML = "xml";
     private static final String JSON = "json";
     protected static final String DOUBLESLASH = "//";
@@ -95,8 +97,7 @@
 
     @Override
     public RestSBDevice getDevice(IpAddress ip, int port) {
-        return deviceMap.values().stream().filter(v -> v.ip().equals(ip)
-                && v.port() == port).findFirst().get();
+        return deviceMap.values().stream().filter(v -> v.ip().equals(ip) && v.port() == port).findFirst().get();
     }
 
     @Override
@@ -124,13 +125,26 @@
 
     @Override
     public boolean post(DeviceId device, String request, InputStream payload, String mediaType) {
-        Response response = getResponse(device, request, payload, mediaType);
-        return checkReply(response);
+        return checkStatusCode(post(device, request, payload, typeOfMediaType(mediaType)));
     }
 
     @Override
-    public <T> T post(DeviceId device, String request, InputStream payload,
-                      String mediaType, Class<T> responseClass) {
+    public int post(DeviceId device, String request, InputStream payload, MediaType mediaType) {
+        Response response = getResponse(device, request, payload, mediaType);
+        if (response == null) {
+            return Status.NO_CONTENT.getStatusCode();
+        }
+        return response.getStatus();
+    }
+
+    @Override
+    public <T> T post(DeviceId device, String request, InputStream payload, String mediaType, Class<T> responseClass) {
+        return post(device, request, payload, typeOfMediaType(mediaType), responseClass);
+    }
+
+    @Override
+    public <T> T post(DeviceId device, String request, InputStream payload, MediaType mediaType,
+                      Class<T> responseClass) {
         Response response = getResponse(device, request, payload, mediaType);
         if (response.hasEntity()) {
             return response.readEntity(responseClass);
@@ -139,65 +153,76 @@
         return null;
     }
 
-    private Response getResponse(DeviceId device, String request, InputStream payload, String mediaType) {
-        String type = typeOfMediaType(mediaType);
+    private Response getResponse(DeviceId device, String request, InputStream payload, MediaType mediaType) {
 
         WebTarget wt = getWebTarget(device, request);
 
         Response response = null;
         if (payload != null) {
             try {
-                response = wt.request(type)
-                        .post(Entity.entity(IOUtils.toString(payload, StandardCharsets.UTF_8), type));
+                response = wt.request(mediaType.getType())
+                        .post(Entity.entity(IOUtils.toString(payload, StandardCharsets.UTF_8), mediaType.getType()));
             } catch (IOException e) {
-                log.error("Cannot do POST {} request on device {} because can't read payload",
-                          request, device);
+                log.error("Cannot do POST {} request on device {} because can't read payload", request, device);
             }
         } else {
-            response = wt.request(type).post(Entity.entity(null, type));
+            response = wt.request(mediaType.getType()).post(Entity.entity(null, mediaType.getType()));
         }
         return response;
     }
 
     @Override
     public boolean put(DeviceId device, String request, InputStream payload, String mediaType) {
-        String type = typeOfMediaType(mediaType);
+        return checkStatusCode(put(device, request, payload, typeOfMediaType(mediaType)));
+    }
+
+    @Override
+    public int put(DeviceId device, String request, InputStream payload, MediaType mediaType) {
 
         WebTarget wt = getWebTarget(device, request);
 
         Response response = null;
         if (payload != null) {
             try {
-                response = wt.request(type)
-                        .put(Entity.entity(IOUtils.toString(payload, StandardCharsets.UTF_8), type));
+                response = wt.request(mediaType.getType()).put(Entity.entity(IOUtils.
+                        toString(payload, StandardCharsets.UTF_8), mediaType.getType()));
             } catch (IOException e) {
-                log.error("Cannot do PUT {} request on device {} because can't read payload",
-                          request, device);
+                log.error("Cannot do PUT {} request on device {} because can't read payload", request, device);
             }
         } else {
-            response = wt.request(type).put(Entity.entity(null, type));
+            response = wt.request(mediaType.getType()).put(Entity.entity(null, mediaType.getType()));
         }
-        return checkReply(response);
+
+        if (response == null) {
+            return Status.NO_CONTENT.getStatusCode();
+        }
+        return response.getStatus();
     }
 
     @Override
     public InputStream get(DeviceId device, String request, String mediaType) {
-        String type = typeOfMediaType(mediaType);
+        return get(device, request, typeOfMediaType(mediaType));
+    }
 
+    @Override
+    public InputStream get(DeviceId device, String request, MediaType mediaType) {
         WebTarget wt = getWebTarget(device, request);
 
-        Response s = wt.request(type).get();
+        Response s = wt.request(mediaType.getType()).get();
 
         if (checkReply(s)) {
-            return new ByteArrayInputStream(s.readEntity((String.class))
-                    .getBytes(StandardCharsets.UTF_8));
+            return new ByteArrayInputStream(s.readEntity((String.class)).getBytes(StandardCharsets.UTF_8));
         }
         return null;
     }
 
     @Override
     public boolean patch(DeviceId device, String request, InputStream payload, String mediaType) {
-        String type = typeOfMediaType(mediaType);
+        return checkStatusCode(patch(device, request, payload, typeOfMediaType(mediaType)));
+    }
+
+    @Override
+    public int patch(DeviceId device, String request, InputStream payload, MediaType mediaType) {
 
         try {
             log.debug("Url request {} ", getUrlString(device, request));
@@ -210,7 +235,7 @@
             }
             if (payload != null) {
                 StringEntity input = new StringEntity(IOUtils.toString(payload, StandardCharsets.UTF_8));
-                input.setContentType(type);
+                input.setContentType(mediaType.getType());
                 httprequest.setEntity(input);
             }
             CloseableHttpClient httpClient;
@@ -219,45 +244,41 @@
             } else {
                 httpClient = HttpClients.createDefault();
             }
-            int responseStatusCode = httpClient
-                    .execute(httprequest)
-                    .getStatusLine()
-                    .getStatusCode();
-            return checkStatusCode(responseStatusCode);
+            return httpClient.execute(httprequest).getStatusLine().getStatusCode();
         } catch (IOException | NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
-            log.error("Cannot do PATCH {} request on device {}",
-                      request, device, e);
+            log.error("Cannot do PATCH {} request on device {}", request, device, e);
         }
-        return false;
+        return Status.BAD_REQUEST.getStatusCode();
     }
 
     @Override
     public boolean delete(DeviceId device, String request, InputStream payload, String mediaType) {
-        String type = typeOfMediaType(mediaType);
+        return checkStatusCode(delete(device, request, payload, typeOfMediaType(mediaType)));
+    }
+
+    @Override
+    public int delete(DeviceId device, String request, InputStream payload, MediaType mediaType) {
 
         WebTarget wt = getWebTarget(device, request);
 
-        // FIXME: do we need to delete an entry by enclosing data in DELETE request?
+        // FIXME: do we need to delete an entry by enclosing data in DELETE
+        // request?
         // wouldn't it be nice to use PUT to implement the similar concept?
-        Response response = wt.request(type).delete();
+        Response response = wt.request(mediaType.getType()).delete();
 
-        return checkReply(response);
+        return response.getStatus();
     }
 
-    private String typeOfMediaType(String mediaType) {
-        String type;
-        switch (mediaType) {
-            case XML:
-                type = MediaType.APPLICATION_XML;
-                break;
-            case JSON:
-                type = MediaType.APPLICATION_JSON;
-                break;
-            default:
-                throw new IllegalArgumentException("Unsupported media type " + mediaType);
+    private MediaType typeOfMediaType(String type) {
+        switch (type) {
+        case XML:
+            return MediaType.APPLICATION_XML_TYPE;
+        case JSON:
+            return MediaType.APPLICATION_JSON_TYPE;
+        default:
+            throw new IllegalArgumentException("Unsupported media type " + type);
 
         }
-        return type;
     }
 
     private void authenticate(Client client, String username, String password) {
@@ -281,32 +302,30 @@
 
     protected String getUrlString(DeviceId device, String request) {
         if (deviceMap.get(device).url() != null) {
-            return deviceMap.get(device).protocol() + COLON + DOUBLESLASH
-                    + deviceMap.get(device).url() + request;
+            return deviceMap.get(device).protocol() + COLON + DOUBLESLASH + deviceMap.get(device).url() + request;
         } else {
-            return deviceMap.get(device).protocol() + COLON +
-                    DOUBLESLASH +
-                    deviceMap.get(device).ip().toString() +
-                    COLON + deviceMap.get(device).port() + request;
+            return deviceMap.get(device).protocol() + COLON + DOUBLESLASH + deviceMap.get(device).ip().toString()
+                    + COLON + deviceMap.get(device).port() + request;
         }
     }
 
     private boolean checkReply(Response response) {
         if (response != null) {
-            return checkStatusCode(response.getStatus());
+            boolean statusCode = checkStatusCode(response.getStatus());
+            if (!statusCode && response.hasEntity()) {
+                log.error("Failed request, HTTP error msg : " + response.readEntity(String.class));
+            }
+            return statusCode;
         }
         log.error("Null reply from device");
         return false;
     }
 
     private boolean checkStatusCode(int statusCode) {
-        if (statusCode == STATUS_OK ||
-                statusCode == STATUS_CREATED ||
-                statusCode == STATUS_ACCEPTED) {
+        if (statusCode == STATUS_OK || statusCode == STATUS_CREATED || statusCode == STATUS_ACCEPTED) {
             return true;
         } else {
-            log.error("Failed request, HTTP error code : "
-                              + statusCode);
+            log.error("Failed request, HTTP error code : " + statusCode);
             return false;
         }
     }
@@ -333,4 +352,5 @@
 
         return ClientBuilder.newBuilder().sslContext(sslcontext).hostnameVerifier((s1, s2) -> true).build();
     }
+
 }
