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

Web service: core_files_get_files could be better described in get_files_parameters() and db/services.php

    XMLWordPrintable

    Details

      Description

      I used the REST demo client to call the function:
      $params = array('contextid' => 5,"component" => "user","filearea" => "private",
      "itemid" => 0,"filepath" => "/","filename" => "image.gif");

      I received the fileinfo and also some other informations (system, backup):

      <?xml version="1.0" encoding="UTF-8" ?>
      <RESPONSE>
      <SINGLE>
      <KEY name="parents"><MULTIPLE>
      <SINGLE>
      <KEY name="contextid"><VALUE>1</VALUE>
      </KEY>
      <KEY name="component"><VALUE null="null"/>
      </KEY>
      <KEY name="filearea"><VALUE null="null"/>
      </KEY>
      <KEY name="itemid"><VALUE null="null"/>
      </KEY>
      <KEY name="filepath"><VALUE null="null"/>
      </KEY>
      <KEY name="filename"><VALUE>System</VALUE>
      </KEY>
      </SINGLE>
      </MULTIPLE>
      </KEY>
      <KEY name="files"><MULTIPLE>
      <SINGLE>
      <KEY name="contextid"><VALUE>5</VALUE>
      </KEY>
      <KEY name="component"><VALUE>user</VALUE>
      </KEY>
      <KEY name="filearea"><VALUE>private</VALUE>
      </KEY>
      <KEY name="itemid"><VALUE>0</VALUE>
      </KEY>
      <KEY name="filepath"><VALUE>/</VALUE>
      </KEY>
      <KEY name="filename"><VALUE>Private files</VALUE>
      </KEY>
      <KEY name="isdir"><VALUE>1</VALUE>
      </KEY>
      <KEY name="url"><VALUE null="null"/>
      </KEY>
      <KEY name="timemodified"><VALUE>1339395467</VALUE>
      </KEY>
      </SINGLE>
      <SINGLE>
      <KEY name="contextid"><VALUE>5</VALUE>
      </KEY>
      <KEY name="component"><VALUE>user</VALUE>
      </KEY>
      <KEY name="filearea"><VALUE>backup</VALUE>
      </KEY>
      <KEY name="itemid"><VALUE>0</VALUE>
      </KEY>
      <KEY name="filepath"><VALUE>/</VALUE>
      </KEY>
      <KEY name="filename"><VALUE>User backup</VALUE>
      </KEY>
      <KEY name="isdir"><VALUE>1</VALUE>
      </KEY>
      <KEY name="url"><VALUE null="null"/>
      </KEY>
      <KEY name="timemodified"><VALUE>0</VALUE>
      </KEY>
      </SINGLE>
      </MULTIPLE>
      </KEY>
      </SINGLE>
      </RESPONSE>

      Client developers probably won't know too much about fileAPI. This function needs some better description to explain how to call it and what is returned. The function also returns three different info when I was expecting to receive only the info about the filename I passed in parameters. This also would need to be explained. Maybe a link to the right fileAPI Moodledocs.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jerome Jérôme Mouneyrac
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: