application.get

Description

integer/array application.get(object **parameters**)

The method allows to retrieve applications according to the given parameters.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
applicationidsstring/arrayReturn only applications with the given IDs.
groupidsstring/arrayReturn only applications that belong to hosts from the given host groups.
hostidsstring/arrayReturn only applications that belong to the given hosts.
inheritedbooleanIf set to true return only applications inherited from a template.
itemidsstring/arrayReturn only applications that contain the given items.
templatedbooleanIf set to true return only applications that belong to templates.
templateidsstring/arrayReturn only applications that belong to the given templates.
selectHostqueryReturn a host property with the host that the application belongs to.
selectItemsqueryReturn an items property with the items contained in the application.
selectDiscoveryRulequeryReturn a discoveryRule property with the LLD rule that created the application.
selectApplicationDiscoveryqueryReturn an applicationDiscovery property with the application discovery object.
sortfieldstring/arraySort the result by the given properties.

Possible values are: applicationid and name.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary page.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

  • an array of objects;

  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving applications from a host

Retrieve all applications from a host sorted by name.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "application.get",
  4. "params": {
  5. "output": "extend",
  6. "hostids": "10001",
  7. "sortfield": "name"
  8. },
  9. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  10. "id": 1
  11. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "applicationid": "13",
  6. "hostid": "10001",
  7. "name": "CPU",
  8. "templateids": []
  9. },
  10. {
  11. "applicationid": "5",
  12. "hostid": "10001",
  13. "name": "Filesystems",
  14. "templateids": []
  15. },
  16. {
  17. "applicationid": "21",
  18. "hostid": "10001",
  19. "name": "General",
  20. "templateids": []
  21. },
  22. {
  23. "applicationid": "15",
  24. "hostid": "10001",
  25. "name": "Memory",
  26. "templateids": []
  27. },
  28. ],
  29. "id": 1
  30. }

See also

Source

CApplication::get() in ui/include/classes/api/services/CApplication.php.