Menu

Inscreva-se para receber novidades

1) Primeiros Passos

2) Perguntas Frequentes

3) Políticas de Configuração de Dispositivos

4) Gestão de Aplicativos e Arquivos

5) Android Enterprise

6) Support in English

7) Parceiros

Informações Adicionais

List Devices – v1  

Isso foi útil?

List Devices – v1  

To list devices, Operation API offers an readonly OData endpoint. Bellow you will find how to make the appropriate call. Just a reminder that to call this endpoint, you need to add a Bearer token in authentication header described here.  

API 

The API endpoint is https://api.cloud4mobile.com.br/devices

Swagger 

More information here at documentation. 

Limits 

The maximum allowed number of devices per page is 50. If you request more per page, a bad request will be returned. 

Filters 

Filters are added to the request using query strings. Don’t forget to add “&” as the separator. Available filters: 

  • status: enumeration to filter the devices based on the status:  
    • Values allowed: 0 (all), 1 (enabled), 2 (disabled), 3 (actives) e 4 (inactives) 
    • Active/Inactive is about the last communication with server. If the last communication with server is bigger than what was defined in the configurations the device is considered inactive. 
    • The default value is 0, if nothing is given in the query string. 
    • Example: &status=1 
  • $expand: Expansion filter, it will be detailed in another section 
  • $top: maximum number of devices per page (until the 50 limit) 
  • $skip: controls pagination 
  • $orderby: orders the results  
    • Example: &$orderby=HardwareId asc 
  • $inlinecount=allpages: returns a HTTP header (X-Total-Count) with the total of devices found with the given filters. 

The filters that starts with “$” belongs to OData protocol and are the only ones allowed from this protocol. 

Pagination Example 

For the example, consider that we have 204 enabled devices in our environment. Consider also that we want to show 25 devices per page, so we would have 9 pages. 

  1. First call: https://api.cloud4mobile.com.br/devices?$top=25&$skip=0 
  1. Second call: https://api.cloud4mobile.com.br/devices?$top=25&$skip=25 
  1. Thrid call: https://api.cloud4mobile.com.br/devices?$top=25&$skip=50 

And so on. To know the total amount of devices you can include the filter $inlinecount=allpages.  

It is possible to control pagination in 2 ways: 

  1. Dynamically: keeping top fixed, if the amount of returned items is less than the skip, so we don’t have more pages. In our example, the last call to the API ($top=25&$skip=225) would return only 4 items, so no more pages left to be returned. 
  1. Statically: add the filter $inlinecount=allpages in the first request (skip=0) and make a calculation with the value that would be used in top. With our example:   
  • X-Total-Count returns 204, fixing top in 25 -> 204/25=8,16 -> 9 pages (8 pages with 25 items e 1 with the last 4 items)  

Expansion filter ($expand) 

By default, only a few informations are returned when you call the endpoint. The details of some informations are only included in the return if explicitly requested. To get more details, you need to use the $expand filter from OData. This are the allowed values used with this option:  

  • DataUsage: returns the data usage from the mobile network from a device. 
  • BatteryMonitorSettings: returns the applied battery monitor configuration in the device. 
  • DataUsageMonitorSettings: returns the applied data usage monitor configuration in the device.  
  • LocationMonitorSettings: returns the applied location monitor configuration in the device. 
  • MemoryMonitorSettings: returns the applied memory monitor configuration in the device. 
  • LocationHistoryMonitorSettings: returns the applied location history configuration in the device. 
  • ApplicationUsageStatisticsMonitorSettings: returns the applied application usage statics (execution time and network usage) monitor configuration in the device. 
  • Group: returns the device group details. 
  • LastBatteryData: returns the latest information collected about the device battery. 
  • LastLocation: returns the latest location collected from the device. 
  • LastMemoryData: returns the latest memory usage information of the device. 
  • Blacklist: returns the list of blocked applications applied to the device. 
  • SamsungPolicySettings: returns the Samsung policy configurations applied in the device. 
  • ApplicationInventory/ApplicationPackages: returns the list of installed applications in the device (software inventory). 
  • ApplicationSettings: returns the applied Samsung application managed configurations in the device. 

More than one option of $expand can be used, just add more filters separated by comma, example:  $expand=DataUsage,Group. The option ApplicationInventory/ApplicationPackages must be used with a slash: $expand=DataUsage,Group,ApplicationInventory/ApplicationPackages. 

API return 

The API return is a list of devices with the requested details. Here are some code samples: 

  • C# 
  • Typescript (Javascript) – em breve 
  • Java – em breve 

See details about return fields in swagger

Compartilhar:

Itens relacionados

Qual é o motivo do seu feedback?

Qual é o motivo do seu feedback?