report.get

Description

integer/array report.get(object parameters)

The method allows to retrieve scheduled reports 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
reportidsstring/arrayReturn only scheduled reports with the given report IDs.
expiredbooleanIf set to true returns only expired scheduled reports, if false - only active scheduled reports.
selectUsersqueryReturn a users property the report is configured to be sent to.
selectUserGroupsqueryReturn a user_groups property the report is configured to be sent to.
sortfieldstring/arraySort the result by the given properties.

Possible values are: reportid, name, status.
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 report data

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "report.get",
  4. "params": [
  5. "output": "extend",
  6. "selectUsers": "extend",
  7. "selectUserGroups": "extend",
  8. "reportids": ["1", "2"]
  9. ],
  10. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  11. "id": 1
  12. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "reportid": "1",
  6. "userid": "1",
  7. "name": "Weekly report",
  8. "dashboardid": "1",
  9. "period": "1",
  10. "cycle": "1",
  11. "start_time": "43200",
  12. "weekdays": "31",
  13. "active_since": "2021-04-01",
  14. "active_till": "2021-08-31",
  15. "subject": "Weekly report",
  16. "message": "Report accompanying text",
  17. "status": "1",
  18. "description": "Report description",
  19. "state": "1",
  20. "lastsent": "1613563219",
  21. "info": "",
  22. "users": [
  23. {
  24. "userid": "1",
  25. "access_userid": "1",
  26. "exclude": "0"
  27. },
  28. {
  29. "userid": "2",
  30. "access_userid": "0",
  31. "exclude": "1"
  32. }
  33. ],
  34. "user_groups": [
  35. {
  36. "usrgrpid": "7",
  37. "access_userid": "0"
  38. }
  39. ]
  40. },
  41. {
  42. "reportid": "2",
  43. "userid": "1",
  44. "name": "Monthly report",
  45. "dashboardid": "2",
  46. "period": "2",
  47. "cycle": "2",
  48. "start_time": "0",
  49. "weekdays": "0",
  50. "active_since": "2021-05-01",
  51. "active_till": "",
  52. "subject": "Monthly report",
  53. "message": "Report accompanying text",
  54. "status": "1",
  55. "description": "",
  56. "state": "0",
  57. "lastsent": "0",
  58. "info": "",
  59. "users": [
  60. {
  61. "userid": "1",
  62. "access_userid": "1",
  63. "exclude": "0"
  64. }
  65. ],
  66. "user_groups": []
  67. }
  68. ],
  69. "id": 1
  70. }

See also

Source

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