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

WS responses are not compatible on site error or upgrade

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.9.6, 3.0.4, 3.1, 3.7.2
    • 3.9
    • Web Services
    • MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_37_STABLE
    • MOODLE_39_STABLE
    • MDL-54799-master
    • Hide
      • As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      • Create a Token in the mobile app service for user s1
        • Click on Site administration ► Plugins ► Web services ► Manage tokens.
      • Edit the config.php and add a print_error right after the require setup.php line (around line 35-36).

        print_error('upgraderunning');

      • Open the console an execute this new curl request, replacing wstoken with the s1 token and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=630bfa4f38f4993f1514bea8a967e2fb&returncontents=1' | python -m "json.tool"

      • Confirm you receive an exception:

        "errorcode": "upgraderunning",
        "exception": "moodle_exception",
        "message": "Site is being upgraded, please retry later."

         

      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for user s1 Click on Site administration ► Plugins ► Web services ► Manage tokens. Edit the config.php and add a print_error right after the require setup.php line (around line 35-36). print_error('upgraderunning'); Open the console an execute this new curl request, replacing wstoken with the s1 token and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=630bfa4f38f4993f1514bea8a967e2fb&returncontents=1' | python -m "json.tool" Confirm you receive an exception: "errorcode": "upgraderunning", "exception": "moodle_exception", "message": "Site is being upgraded, please retry later."  

    Description

      When calling a WebService, if there's a site error (i.e config) or the site is upgrading it returns a HTML with the same content as web client.

      It should return a WS compatible error message to avoid errors in app and WS clients.

      Attachments

        Activity

          People

            pferre22 Pau Ferrer
            pferre22 Pau Ferrer
            Shamim Rezaie Shamim Rezaie
            Adrian Greeve Adrian Greeve
            Janelle Barcega Janelle Barcega
            Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              15/Jun/20

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 45 minutes
                4h 45m