diff --git a/xos/synchronizer/steps/sync_vtn_service.py b/xos/synchronizer/steps/sync_vtn_service.py
index bccfe0c..000f303 100644
--- a/xos/synchronizer/steps/sync_vtn_service.py
+++ b/xos/synchronizer/steps/sync_vtn_service.py
@@ -98,33 +98,52 @@
         glo_saved_vtn_maps = vtn_maps
         # TODO: save this
 
+    def get_method(self, url, id):
+        url_with_id = "%s/%s" % (url, id)
+        r = requests.get(url_with_id, auth=self.get_vtn_auth())
+        if (r.status_code==200):
+            method="PUT"
+            url = url_with_id
+            req_func = requests.put
+            exists=True
+        else:
+            method="POST"
+            req_func = requests.post
+            exists=False
+        return (exists, url, method, req_func)
+
     def sync_service_networks(self):
         valid_ids = []
         for network in Network.objects.all():
             network = VTNNetwork(network)
             valid_ids.append(network.id)
             if (glo_saved_networks.get(network.id, None) != network.to_dict()):
-                logger.info("POSTing VTN API for network %s" % network.id)
+                (exists, url, method, req_func) = self.get_method("http://" + self.get_vtn_addr() + ":8181/onos/cordvtn/serviceNetworks", network.id)
 
-                url = "http://" + self.get_vtn_addr() + ":8181/onos/serviceNetworks/%s" % network.id
+                logger.info("%sing VTN API for network %s" % (method, network.id))
+
                 logger.info("URL: %s" % url)
 
-                data = {"id": network.id,
+                # clean the providerNetworks list
+                providerNetworks = [{"id": x["id"], "bidirectional": x["bidirectional"]} for x in network.providerNetworks]
+
+                data = {"ServiceNetwork": {"id": network.id,
                         "type": network.type,
-                        "providerNetworks": network.providerNetworks}
+                        "providerNetworks": providerNetworks} }
                 logger.info("DATA: %s" % str(data))
 
-                r=requests.post(url, data=data, auth=self.get_vtn_auth() )
-                if (r.status_code in [200]):
+                r=req_func(url, json=data, auth=self.get_vtn_auth() )
+                if (r.status_code in [200,201]):
                     glo_saved_networks[network.id] = network.to_dict()
                 else:
                     logger.error("Received error from vtn service (%d)" % r.status_code)
 
+
         for network_id in glo_saved_networks.keys():
             if network_id not in valid_ids:
                 logger.info("DELETEing VTN API for network %s" % network_id)
 
-                url = "http://" + self.get_vtn_addr() + ":8181/onos/serviceNetworks/%s" % network_id
+                url = "http://" + self.get_vtn_addr() + ":8181/onos/cordvtn/serviceNetworks/%s" % network_id
                 logger.info("URL: %s" % url)
 
                 r = requests.delete(url, auth=self.get_vtn_auth() )
@@ -139,18 +158,19 @@
             port = VTNPort(port)
             valid_ids.append(port.id)
             if (glo_saved_ports.get(port.id, None) != port.to_dict()):
-                logger.info("POSTing VTN API for port %s" % port.id)
+                (exists, url, method, req_func) = self.get_method("http://" + self.get_vtn_addr() + ":8181/onos/cordvtn/servicePorts", port.id)
 
-                url = "http://" + self.get_vtn_addr() + ":8181/onos/servicePorts/%s" % port.id
+                logger.info("%sing VTN API for port %s" % (method, port.id))
+
                 logger.info("URL: %s" % url)
 
-                data = {"id": port.id,
+                data = {"ServicePort": {"id": port.id,
                         "vlan_id": port.vlan_id,
-                        "floating_address_pairs": port.floating_address_pairs}
+                        "floating_address_pairs": port.floating_address_pairs} }
                 logger.info("DATA: %s" % str(data))
 
-                r=requests.post(url, data=data, auth=self.get_vtn_auth() )
-                if (r.status_code in [200]):
+                r=req_func(url, json=data, auth=self.get_vtn_auth() )
+                if (r.status_code not in [200,201]):
                     glo_saved_ports[port.id] = port.to_dict()
                 else:
                     logger.error("Received error from vtn service (%d)" % r.status_code)
@@ -159,7 +179,7 @@
             if port_id not in valid_ids:
                 logger.info("DELETEing VTN API for port %s" % port_id)
 
-                url = "http://" + self.get_vtn_addr() + ":8181/onos/servicePorts/%s" % port_id
+                url = "http://" + self.get_vtn_addr() + ":8181/onos/cordvtn/servicePorts/%s" % port_id
                 logger.info("URL: %s" % url)
 
                 r = requests.delete(url, auth=self.get_vtn_auth() )
