diff --git a/lib/Citycom/OanApiClient.php b/lib/Citycom/OanApiClient.php index 7d61e91f7..e4adf823d 100644 --- a/lib/Citycom/OanApiClient.php +++ b/lib/Citycom/OanApiClient.php @@ -177,6 +177,33 @@ class Citycom_OanApiClient { } + public function getService($service_id) { + if(!$this->token) { + $this->getAuthToken(); + if(!$this->token) { + return false; + } + } + + //$url = $this->baseurl.CITYCOM_OAN_API_EP_GET_SERVICES; + $url = str_replace("{service_id}", $service_id, $this->baseurl.CITYCOM_OAN_API_EP_GET_SERVICE); + + $ctx_options = [ + "http" => [ + "ignore_errors" => true, + "method" => "GET", + "header" => [ + "Accept: application/json", + "Authorization: Bearer ".$this->token, + ], + ] + ]; + + $service = $this->runApiRequest($url, $ctx_options); + return $service; + + } + public function createService($data) { if(!$this->token) { $this->getAuthToken(); diff --git a/lib/Citycom/OanApiHelper.php b/lib/Citycom/OanApiHelper.php index 6851216b5..0ac26a079 100644 --- a/lib/Citycom/OanApiHelper.php +++ b/lib/Citycom/OanApiHelper.php @@ -276,7 +276,7 @@ class Citycom_OanApiHelper { */ public function updateService($service_ext_id, $data) { // get service and compare data - $services = $this->api->getServices(); + /*$services = $this->api->getServices(); if(!$services) { $this->log->error(__METHOD__.": Error getting services."); return false; @@ -288,7 +288,9 @@ class Citycom_OanApiHelper { $service = $cc_service; break; } - } + }*/ + + $service = $this->api->getService($service_ext_id); if(!$service) { $this->log->error(__METHOD__.": Service not available.");