01-17-2020 04:11 PM
Hello Friends,
So, I am trying to use soapclient with PHP to query the status of a phone.
I am aware that risport70 can do that, however, it does go pull all the records every time I query.
Also, I am not seeing a method like <DeviceName> or <Name> to query.
Could someone help me with how to query just a single phone with its MAC address?
Below is what I am trying now,
I appreciate your help.
Regards
Sanjay
01-21-2020 05:27 PM
Essentially you want to provide an <items> array with a single <Item> with your device name - so the equivalent of this XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.cisco.com/ast/soap"> <soapenv:Header/> <soapenv:Body> <soap:selectCmDevice> <soap:StateInfo/> <soap:CmSelectionCriteria> <soap:MaxReturnedDevices>1000</soap:MaxReturnedDevices> <soap:DeviceClass>Phone</soap:DeviceClass> <soap:Model>255</soap:Model> <soap:Status>Any</soap:Status> <soap:NodeName/> <soap:SelectBy>Name</soap:SelectBy> <soap:SelectItems> <soap:item> <soap:Item>EMDSTAUDT</soap:Item> </soap:item> </soap:SelectItems> <soap:Protocol>Any</soap:Protocol> <soap:DownloadStatus>Any</soap:DownloadStatus> </soap:CmSelectionCriteria> </soap:selectCmDevice> </soapenv:Body> </soapenv:Envelope>
Can't properly test at the moment, but it might look something like this in PHP:
$devices = $client->SelectCmDevice(array("StateInfo"=>"", "CmSelectionCriteria"=>array( "Status"=>"Any", "SelectBy"=>"Name", "SelectItems"=>array( "item"=>array( "Item"=>"EMDSTAUDT" ), ) ) );
01-22-2020 12:51 AM
I put together a few PHP based Serviceability API samples here...hope to collect more going forward: https://github.com/CiscoDevNet/serviceability-php-samples
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide