Howto:Retrieve configuration of all PBX Objects using SOAP API: Difference between revisions
(New page: Here is a description of the method how to get the complete PBX Object list and the associated Object configuration as an XML dataset. ==Applies To== This information applies to * all PB...) |
(No difference)
|
Revision as of 16:47, 14 July 2015
Here is a description of the method how to get the complete PBX Object list and the associated Object configuration as an XML dataset.
Applies To
This information applies to
- all PBX platforms
More Information
Problem Details
The SOAP API function Admin can be used to list all PBX Objects and their contents by providing a wild card search parameter * as search string for cn.
However, on the large PBXes with big number of PBX Objects, this may fail, because the system can not deliver all the data in one single batch.
Solution
The solution is to retrieve the data in multiple smaller pages.
Therefore use SOAP API function FindUser to get parts of the PBX Objects list. The best practice is to get PBX Objects names in pages with 50 Objects. Than retrieve the corresponding Object details one by one as XML data set.
An example code in PHP:
$next = false;
$last_user_cn = ""; // start with an empty string to get first objects
while (true) {
$users = $inno->FindUser(true, true, true, true, $last_user_cn, null, null, 50, $next, false);
if (count($users) == 0) break; // stop, in case no objects delivered
$next = true;
$last_user_cn = end($users)->cn;
foreach ($users as $user) { //iterate through the object list
echo $user->cn.":\r\n";
echo ($inno->Admin("<show><user cn=\"".$user->cn."\"/></show>")); //get XML data of the each particular object
echo "\r\n";
}
}