Get a Device's First DN

Problem

Your application needs to retrieve the first DN of a device registered with Cisco Unified CM.

Solution

Cisco UC Manager Version: 8.5

Use the executeSQLQuery AXL API. You can specify the device that you want to retrieve information for by using the device name. In this example, we will only be retrieving the first DN and we will use a SQL statement to execute this request.

Step 1: Retrieve Phone Information

In this example, we will use the executeSQLQuery API to retrieve information about the phone. We are going to pass in the device name of the phone.

executeSQLQuery
Request Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:executeSQLQuery sequence="?">
        <sql>SELECT FIRST 1 dnorpattern FROM Device, DeviceNumPlanMap, NumPlan WHERE
			DeviceNumPlanMap.fkNumPlan = NumPlan.pkid
			AND device.pkid=DeviceNumPlanMap.fkDevice
			AND device.name="SEP123456789012"
		</sql>
      </ns:executeSQLQuery>
   </soapenv:Body>
</soapenv:Envelope>
	
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns:executeSQLQueryResponse xmlns:ns="http://www.cisco.com/AXL/API/8.5">
         <return>
            <row>
               <dnorpattern>1000</dnorpattern>
            </row>
         </return>
      </ns:executeSQLQueryResponse>
   </soapenv:Body>
</soapenv:Envelope>