An external software supplier wanted to make a new app available for a selected group of smartphones. We were asked if it would be possible to retrieve the smartphone from the XenMobile database. New smartphones added to the delivery group would be detected automatically. Since XenMobile has a REST API, this didn’t seem like a problem at first. We made the REST API available to our software supplier, after which they created a link between their backend and our On-Prem XenMobile environment based on the Citrix XenMobile REST API documentation
At first everything seemed to work perfectly and our software supplier thought they saw all our devices. After some time we noticed that there was a difference between the devices visible in the XenMobile console (Web GUI) and the devices that our software supplier saw through the REST API. Based on the query that was used in the REST API, we then did some testing ourselves using Postman, in the hope of uncovering the difference in devices.
For the sake of completeness, in XenMobile we have created new a delivery group, which only contains the new application supplied by the software supplier. This delivery group is linked to an AD Group, so that only employees who are member of the relevant AD group can access the new application. From the XenMobile Web GUI you can click on the delivery group and will be presented with an overview of installed, pending and failed devices.
According to the REST API documentation, multiple queries are possible to request the devices:
Although section 3.16.1 & 3.16.2 recommend we should use 3.16.3, this only applies to Endpoint Management running in the cloud. The Url https://hostname:4443/api/endpoint-management/devices/filter does not work with XenMobile On-Prem.
A simple test with Postman indeed returned all devices within the XenMobile database. However we only wanted to retrieve all devices within the newly created delivery group.
We will therefore have to extend the query with a filterIds, so that we do not retrieve all devices. We added a “filterIds” with the name of the AD Group, which is associated with the delivery group:
The outcome looked promising, we saw fewer devices than before, but now we noticed there were suddenly far too few.
We contacted Citrix Support as we didn’t understand the difference between the Web GUI and the REST API, but apparently it wasn’t that obvious either. The support for the REST API was a bit disappointing and it took quite some effort to get substantiated answers.
From the code side, both the console API and the public REST API call the same function to retrieve all devices, except the filterIds would be different. While the console API is for all devices, the public REST API with filterIds is only for the AD user group, hence we get a smaller number of devices. When using a filtersIds the public REST API will fetch devices for this AD group only, not all devices within de Delivery Group attached. We were told it would not be possible to filter all devices based on a delivery group with the XenMobile On Premise public REST API.
The outcome of this support case was not quite what we had hoped for. If XenMobile uses the same functions for the console API as the public REST API, why is it possible to query all devices per delivery group in de Web GUI, but not when using the public REST API? Sounds a bit weird if you ask me. Because we weren’t supplied with a satisfaction solution we did asked if there would be another way to fulfill our needs. Unfortunately we received two SQL queries instead.
Query to check how many devices are within a delivery group:
select count(DEVICE_ID) from DEVICE where DEVICE.LAST_USER_ID in (select userid from userroles where userroles.roleid=(select id from roles where roles.name='DeliveryGroupName'));
Query to show which devices are within the delivery group:
select SERIAL_NUMBER, IMEI,LAST_USERNAME from DEVICE where DEVICE.LAST_USER_ID in (select userid from userroles where userroles.roleid=(select id from roles where roles.name='DeliveryGroupName'));
Although these SQL queries did indeed provide the information, we couldn’t do much with this. Our external software supplier has no access to the SQL server itself, but only the REST API. We submitted an enhancement request and hope the XenMobile product managers will grant the request. Hopefully in the future there will be a possibility to do this using the REST API.