Currenlty if i want to get accounts from a group i have to fetch all users then filter its group with php. Is there any way to fetch all user from a group. Like i have group 3 and 5 . I only need users from group 3 . Currently i am doing by iterating 15000 users then filtering in php loop
$wsdl_url = 'https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL';
$client = new SoapClient($wsdl_url, array("trace" => 1, "exceptions" => 1));
$client->ConnectWithToken(
array(
'token' => '******',
'appToken' => '******'
)
);
$accounts = $client->Debtor_GetAll();
foreach($accounts->Debtor_GetAllResult->DebtorHandle as $account)
{
$data = $client->Debtor_GetData(array('entityHandle' => $account));
$user_id = $email = $name = $password = $vat_number = $phone = '';
// Make sure required values are present (e-mail and ID)
if(!isset($data->Debtor_GetDataResult->Number, $data->Debtor_GetDataResult->Email))
{
continue;
}
$user_id = utf8_decode($data->Debtor_GetDataResult->Number);
$email = utf8_decode($data->Debtor_GetDataResult->Email);
if(isset($data->Debtor_GetDataResult->Name))
{
$name = utf8_decode($data->Debtor_GetDataResult->Name);
}
if($data->Debtor_GetDataResult->DebtorGroupHandle->Number == 5){$i++;
$userdata = array();
$userdata['user_id'] = $user_id;
$userdata['group_id'] = $data->Debtor_GetDataResult->DebtorGroupHandle->Number;
$userdata['name'] = $name;
echo $userdata['name'];
echo "<br>";
}
}
You need to pass group id to find the users by group
$groupHandle= $client
->DebtorGroup_FindByNumber(array('number'=>$group_id))
->DebtorGroup_FindByNumberResult;
$debtorHandles = $client->DebtorGroup_GetDebtors(array('debtorGroupHandle'=>$groupHandle))
->DebtorGroup_GetDebtorsResult
->DebtorHandle;