updating Rimo subAddress when changing Home tuer
This commit is contained in:
@@ -52,6 +52,45 @@ class Rimoapi {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function changeHomeSubAddress($apikey, $home_external_id, $subAddress) {
|
||||
if(!$apikey) return false;
|
||||
if(!$home_external_id) return false;
|
||||
|
||||
$log = mfLoghandler::singleton();
|
||||
|
||||
// send request to Rimo Api
|
||||
$params = [];
|
||||
$params['apiKey'] = $apikey;
|
||||
$params['homeId'] = $home_external_id;
|
||||
$params['subAddress'] = $subAddress;
|
||||
|
||||
$ctx_opts = [
|
||||
'http' => [
|
||||
'method' => 'PUT',
|
||||
'header' => 'accept: application/json'
|
||||
]
|
||||
];
|
||||
|
||||
$qs = http_build_query($params);
|
||||
|
||||
$changeSubAddressEp = RIMO_API_JSON_URL.RIMO_API_JSON_EP_CHANGE_HOME_SUBADDRESS;
|
||||
$put_url = $changeSubAddressEp."?".$qs;
|
||||
$ctx = stream_context_create($ctx_opts);
|
||||
$log->debug(__METHOD__.": SubAddress Change in Rimo: $put_url");
|
||||
$response = file_get_contents($put_url, false, $ctx);
|
||||
$log->debug(__METHOD__.": response: ".print_r($response,true));
|
||||
|
||||
if($response === false) {
|
||||
$log->error("Fehler beim Update der SubAddress in RIMO ".$home_external_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
$resp_data = json_decode($response);
|
||||
if(!$resp_data->id) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getFtuData($oaid, $home_external_id) {
|
||||
//$oaid = $oaid;
|
||||
$log = mfLoghandler::singleton();
|
||||
|
||||
Reference in New Issue
Block a user