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

How to set parameter to null in a web service call

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 2.0, Future Dev
    • Web Services
    • MOODLE_20_STABLE

      This morning we had an interesting question wit Martin about to send a null parameter in a web service call.

      For example in the update_user function, we could have a field:
      'age' => new external_value(PARAM_INT, 'User age', VALUE_OPTIONAL),
      Imagine that the ws client wants to set this field to null. (because he entered a wrong age and finally he doesn't really know what is the user age.)

      In this case a solution could be:
      the ws client sends a '' or 'null' value. Then the external update_user function compare this value, and replace by php null, before to call the validate_parameters function.

            moodle.com Moodle HQ
            jerome Jérôme Mouneyrac
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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