module.get

Description

integer/array module.get(object parameters)

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

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
moduleidsstring/arrayReturn only modules with the given IDs.
sortfieldstring/arraySort the result by the given properties.

Possible values: moduleid, relative_path.
countOutputbooleanThese parameters being common for all get methods are described in detail in the Reference commentary page.
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 a module by ID

Retrieve all data about modules “1”, “2”, and “25”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "module.get",
  4. "params": {
  5. "output": "extend",
  6. "moduleids": [
  7. "1",
  8. "2",
  9. "25"
  10. ]
  11. },
  12. "id": 1
  13. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "moduleid": "1",
  6. "id": "actionlog",
  7. "relative_path": "widgets/actionlog",
  8. "status": "1",
  9. "config": []
  10. },
  11. {
  12. "moduleid": "2",
  13. "id": "clock",
  14. "relative_path": "widgets/clock",
  15. "status": "1",
  16. "config": []
  17. },
  18. {
  19. "moduleid": "25",
  20. "id": "example",
  21. "relative_path": "modules/example_module",
  22. "status": "1",
  23. "config": []
  24. }
  25. ],
  26. "id": 1
  27. }

See also

Source

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