Nested functions allow CUC Custom XML functions to obtain values for required data parameters through separate queries that are executed before the main API call is made. For example, to provision a new User Template in CUC, the Object ID of the phone system must be provided (within XML label, MediaSwitchObjectId). Since the Phone System’s Object ID is both unknown and variable it must first be queried, held in a local variable then applied to the MediaSwitchObjectId label as part of the main XML call.

The nested function calls and the variables in which their results will be held are executed in a section above and separate from the main REST API call. The section is delimited by the strings, <--nested and -->, each on separate lines.

Within the nested section each nested call and associated variable are defined in the format:

Variable = REST API function

For example, to query the data of the Phone System named, PhoneSystem, and store the result in a variable called, phonesysQueryResults, the following nested call would be needed:

<--nested
phonesysQueryResults = vmrest/phonesystems?query=(DisplayName%20is%20PhoneSystem)
-->

The result set from the previous example will look similar to the following code block. As stated earlier, it will be stored in its entirety in the variable, phonesysQueryResults.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PhoneSystems total="1">
    <PhoneSystem>
        <URI>/vmrest/phonesystems/37900370-4c0b-4733-97bf-3e411640407a</URI>
        <ObjectId>37900370-4c0b-4733-97bf-3e411640407a</ObjectId>
        <DisplayName>PhoneSystem</DisplayName>
        <MwiAlwaysUpdate>false</MwiAlwaysUpdate>
        <MwiPortMemory>false</MwiPortMemory>
        <CcmAXLUser>ccmaxl</CcmAXLUser>
        <CcmAXLPassword>xR/ls6fQAc+A1sYCPWeanA==</CcmAXLPassword>
        <CallLoopSupervisedTransferDetect>true</CallLoopSupervisedTransferDetect>
        <CallLoopForwardNotificationDetect>true</CallLoopForwardNotificationDetect>
        <CallLoopDTMF>A</CallLoopDTMF>
        <CallLoopGuardTimeMs>2500</CallLoopGuardTimeMs>
        <PortCount>10</PortCount>
        <EnablePhoneApplications>false</EnablePhoneApplications>
        <DefaultTRaPSwitch>true</DefaultTRaPSwitch>
        <MwiForceOff>false</MwiForceOff>
        <RestrictDialUnconditional>false</RestrictDialUnconditional>
        <RestrictDialScheduled>false</RestrictDialScheduled>
        <RestrictDialStartTime>0</RestrictDialStartTime>
        <RestrictDialEndTime>0</RestrictDialEndTime>
        <CallLoopExtensionDetect>true</CallLoopExtensionDetect>
        <AXLServerURI>/vmrest/phonesystems/37900370-4c0b-4733-97bf-3e411640407a/axlservers</AXLServerURI>
        <PhoneSystemAssociationURI>/vmrest/phonesystems/37900370-4c0b-4733-97bf-3e411640407a/phonesystemassociations</PhoneSystemAssociationURI>
    </PhoneSystem>
</PhoneSystems>

From the result set above, only the contents of ObjectId are needed, which will need to be further queried from the container variable. The value of ObjectId will be used in the User Template XML label, MediaSwitchObjectId. The following notation method will be used to extract the specific value desired from the nested result set:

|nested.NestedResultVariable._XMLPath_|

Using the example above, the XML label, MediaSwitchObjectId, will look like the following:

<MediaSwitchObjectId>|nested.phonesysQueryResults.PhoneSystems.ObjectId|</MediaSwitchObjectId>

Following is an example of an XML call in Akkadian Site Builder to create a new User Template with the alias, “voicemail-user-template.” Note that the Global Variable, Customer, is used within the DisplayName field. As mentioned in the Global Variable section, the value of Customer will be prompted at provisioning and will be inserted where the Global Variable’s placeholder is displayed.

Nested functions can also be used in URL End Points. For example, some URLs require Object IDs. The URL for adding a SIP Server to an existing Port Group is one such case. The illustration below demonstrates how a nested query can be implemented in the URL End Point string.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment