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

Webservice documentation improvement

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.9.14, 3.10.11, 3.11.7, 4.0.1
    • None
    • Web Services
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE

    Description

      I run an issue with how to properly parametrize the call to "core_enrol_submit_user_enrolment_form" webservice.

      It should be good if all the webservices would have a detailed documentation with samples.

      For example the "core_enrol_submit_user_enrolment_form" webservice has not enough data fro use.

      The description is: Submit form data for enrolment form
      REST (POST parameters):
      formdata= string

      Fact, the manual enrolment form uses the following data:  id (at table: user_enrolments), enrolid, userid, rolid, timestart, timeend,
      but I did not find any workable combination of the parameterize "formdata"

      I used the call:
      /webservice/rest/server.php?moodlewsrestformat=json&wstoken={token}&wsfunction=core_enrol_submit_user_enrolment_form&formdata=%7B%22ue%22:%22740%22,%22timestart%22:%22%22,%22timeend%22:%221661990399%22%7D
      The last part of the call-url is (in PHP): 
      '&formdata={"ue":"'.$enrolments_id.'","timestart":"'.$unixtimestart.'","timeend":"'.$unixtimeend.'"}';

      But it may wrong because nowhere documented the formdata what really is?

      I am receiving the following error:
                  [exception] => dml_missing_record_exception
                  [errorcode] => invalidrecord
                  [message] => The user_enrolments table does not contain records.
                  [debuginfo] => SELECT * FROM {user_enrolments} WHERE id IS NULL

      And, it looks like the  SELECT function did not work in 'user_enrolments' table without passing the id value.
      How to pass id value properly?

      So, it is the reason why I suggested ti improve webservice documentaiton.

      Attachments

        Activity

          People

            Unassigned Unassigned
            holbi István Holbok
            Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: