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

Allow specifying a timezone when calling WebServices

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • MOODLE_310_STABLE
    • MDL-69283-master
    • Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Go to Administration > Location > Location settings and set the "Force timezone" option to "Users can choose their time zone"
      3. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Access to the Moodle site using the user account from previous step
      5. Go to your user profile and click the "Edit profile" link within the "User details section"
      6. Change the indicated Timezone to "Europe/Madrid" and "Save changes"
      7. Go to your calendar (from the site home or your dashboard not from inside a course) and create a personal/User event for yesterday at 10pm
      8. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Change the year, month and day values so they match to the same day you created the calendar event in the previous step

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'year=2020&month=9&day=16&wsfunction=core_calendar_get_calendar_day_view&wstoken=YOUR_WS_TOKEN' --compressed | python -m "json.tool"

      9. Confirm that:
        • In the curl request response, you see among data a first-level element called "events" that contains information from the event you created a few steps ago
      10. Now, add the following parameter to the previous currl request: moodlewssettingtimezone=Australia/Perth
      11. Execute the curl request and confirm that:
        • In the curl request response, you see among data a first-level element called "events" that is empty
      12. Now, in the previous CURL request, change the day (add one day, so if it was the 16 use 17)
      13. Execute the curl request and confirm that:
        • In the curl request response, you see among data a first-level element called "events" that contains information from the event you created a few steps ago
      14. As admin, access to your Moodle site again
      15. Go to Administration > Location > Location settings and set the "Force timezone" option to "Europe/Madrid"
      16. Execute the last curl request (previous step) and confirm that:
        • In the curl request response, you see among data a first-level element called "events" that is empty
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Go to Administration > Location > Location settings and set the "Force timezone" option to "Users can choose their time zone" Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Access to the Moodle site using the user account from previous step Go to your user profile and click the "Edit profile" link within the "User details section" Change the indicated Timezone to "Europe/Madrid" and "Save changes" Go to your calendar (from the site home or your dashboard not from inside a course) and create a personal/User event for yesterday at 10pm Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Change the year, month and day values so they match to the same day you created the calendar event in the previous step curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'year=2020&month=9&day=16&wsfunction=core_calendar_get_calendar_day_view&wstoken=YOUR_WS_TOKEN' --compressed | python -m "json.tool" Confirm that: In the curl request response, you see among data a first-level element called "events" that contains information from the event you created a few steps ago Now, add the following parameter to the previous currl request: moodlewssettingtimezone=Australia/Perth Execute the curl request and confirm that: In the curl request response, you see among data a first-level element called "events" that is empty Now, in the previous CURL request, change the day (add one day, so if it was the 16 use 17) Execute the curl request and confirm that: In the curl request response, you see among data a first-level element called "events" that contains information from the event you created a few steps ago As admin, access to your Moodle site again Go to Administration > Location > Location settings and set the "Force timezone" option to "Europe/Madrid" Execute the last curl request (previous step) and confirm that: In the curl request response, you see among data a first-level element called "events" that is empty

      In the app we want to use the device timezone instead of the Moodle timezone. This is causing problems in calendar WebServices, for example the day_view WS calculates which events to return based on the Moodle timezone instead of the device timezone.

      It would be great to have a parameter to be able to define the timezone to use.

        1. Screenshot_1.jpg
          Screenshot_1.jpg
          51 kB
        2. Screenshot_2.jpg
          Screenshot_2.jpg
          36 kB
        3. Screenshot_3.jpg
          Screenshot_3.jpg
          98 kB

            jleyva Juan Leyva
            dpalou Dani Palou
            Dani Palou Dani Palou
            Jun Pataleta Jun Pataleta
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 14 minutes
                3h 14m

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