Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-74956

New Web Service core_reportbuilder_retrieve_report

XMLWordPrintable

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • Hide

      The new external classes/exporters are covered by unit tests, to manually test you can do the following:

      1. Log in as admin
      2. Enable web service
      3. Enable web service protocols at admin/settings.php?section=webserviceprotocols
      4. Generate, and make note of, token for the admin user
      5. Select Reports from the user menu
      6. Create a new report from Users report source
        • Make a note of the report ID (look at URL: reportbuilder/edit.php?id=<REPORTID>)
      7. Execute the following web service request

        $ curl --silent "<WWROOT>/webservice/rest/server.php?moodlewsrestformat=json" --data "wstoken=<TOKEN>&wsfunction=core_reportbuilder_retrieve_report&reportid=<REPORTID>" | python -m "json.tool"
        

      8. Confirm the following output:

        {
            "data": [
              {
                // Report data.
              },
            "details": [
              {
                // Report details.
              },
            ],
            "warnings": []
        }
        

      9. Confirm that the "Report data" contains the data within your report:
        • "headers" should contain a list of headers
        • "rows" should contain an array of items, each containing a "columns" property with the actual row data
        • "totalrowcount" should contain total row count
      10. Confirm that the "Report details" contains information about the report you created (name, source, modified by, etc)
      Show
      The new external classes/exporters are covered by unit tests, to manually test you can do the following: Log in as admin Enable web service Enable web service protocols at admin/settings.php?section=webserviceprotocols Generate, and make note of, token for the admin user Select Reports from the user menu Create a new report from Users report source Make a note of the report ID (look at URL: reportbuilder/edit.php?id=<REPORTID> ) Execute the following web service request $ curl --silent "<WWROOT>/webservice/rest/server.php?moodlewsrestformat=json" --data "wstoken=<TOKEN>&wsfunction=core_reportbuilder_retrieve_report&reportid=<REPORTID>" | python -m "json.tool" Confirm the following output: { "data": [ { // Report data. }, "details": [ { // Report details. }, ], "warnings": [] } Confirm that the "Report data" contains the data within your report: "headers" should contain a list of headers "rows" should contain an array of items, each containing a "columns" property with the actual row data "totalrowcount" should contain total row count Confirm that the "Report details" contains information about the report you created (name, source, modified by, etc)
    • WP 4.0 - ES2 (Marina), WP 4.0 - ES3 (Marina)

      Web Service to retrieve data for a particular report

      Create a new webservice: core_reportbuilder_reports_retrieve($reportid, $page = 0, $perpage = 0) [*]

      Parameters: 

      • reportid (the report id obtained from the previous WS)
      • page current page to display
      • perpage number of rows per page

      Returns:

      The report data, maybe the same as that for custom_report_exporter::get_read_structure(); but without the table rendered (just the structured data to be able to render the report)

      Among the returned information the total number of rows should be returned (for pagination)

      Filters for the report should be applied as same as they are for the web version

      If the user sorted the report in the web version, just apply the same sorting in the WebService so it is consistent

      The web version preferences for the report should be kept in the Web Service response (filters and sorting)

      [*] Note that as per discussion on MDL-74957, the naming of this issue will not be consistent with the rest of the core_reportbuilder external services, and will instead be named core_reportbuilder_retrieve_report

            pholden Paul Holden
            jleyva Juan Leyva
            David Carrillo David Carrillo
            Ilya Tregubov Ilya Tregubov
            John Edward Pedregosa John Edward Pedregosa
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 6 minutes
                5h 6m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.