change Citycom OAN Api Helper updateService() to get only single service before update

This commit is contained in:
Frank Schubert
2026-02-11 14:23:01 +01:00
parent 4b72e3a678
commit aa03f29d8f
2 changed files with 31 additions and 2 deletions

View File

@@ -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();

View File

@@ -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.");