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

notes externallib functions: validate_parameters() second parameter is not well formatted

    XMLWordPrintable

Details

    • MOODLE_25_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MDL-41026-master
    • Hide

      Requirements

      1. A ws setup.
      2. A ws client of your choice. You can use https://github.com/ankitagarwal/moodle-ws-client/blob/master/client.php if you like.

      Test

      1. Create a few notes. (You can do this by visiting any user profile in a course). Add notes in all different contexts (Site, personal, course)
      2. Update your ws script to call function "core_notes_get_notes" and params as an array of note ids

        $params['notes'] = array(1,2,3); // If using REST
        $params = array(array(1,2,3)); // for xml-rpc
        

      3. Make the ws call, make sure you get the note details in response and not an invalid param error.
      4. Repeat this with core_notes_delete_notes (The response for delete calls are empty xml structure)
      Show
      Requirements A ws setup. A ws client of your choice. You can use https://github.com/ankitagarwal/moodle-ws-client/blob/master/client.php if you like. Test Create a few notes. (You can do this by visiting any user profile in a course). Add notes in all different contexts (Site, personal, course) Update your ws script to call function "core_notes_get_notes" and params as an array of note ids $params['notes'] = array(1,2,3); // If using REST $params = array(array(1,2,3)); // for xml-rpc Make the ws call, make sure you get the note details in response and not an invalid param error. Repeat this with core_notes_delete_notes (The response for delete calls are empty xml structure)

    Description

      https://tracker.moodle.org/browse/MDL-30072?focusedCommentId=228182&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-228182

      Hi,
      I have issues with the delete_notes WS functions...

      After a review of the notes/externallib.php code review, a fix could be, on line 229:
      $params = self::validate_parameters(self::delete_notes_parameters(), array('notes' => $notes));
      Instead of:
      $params = self::validate_parameters(self::delete_notes_parameters(), $notes);
      The errors I have with the WS function are:
      Calling parameters do not match signature
      (If I incorporate the 'notes' index that is missing) Or
      Missing required key in single structure: notes
      (If I do not incorporate it...)
      As I have tested all the combinations possible for the WS function parameter, I hope it is not a misunderstanding on my side...

      Attachments

        Activity

          People

            jerome Jérôme Mouneyrac
            jerome Jérôme Mouneyrac
            Ankit Agarwal Ankit Agarwal
            Andrew Lyons Andrew Lyons
            Adrian Greeve Adrian Greeve
            Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              2/Feb/15