title: How to get all the files from the Moodle assignment in a course?
body: <p>I want to get all the files from an assignment in Moodle. Is there a way to get all the files?</p>
  <p>When I <strong>call core_course_get_contents</strong> from my local Moodle instance as</p>
  <p>http://localhost:8077/webservice/rest/server.php?wstoken=11e2d8b7f8e21ca1804e41e9cac5a816&amp;wsfunction=core_course_get_contents&amp;courseid=4&amp;moodlewsrestformat=json</p>
  <p>I receive the response as:</p>
  <pre><code>[
      {
          &quot;id&quot;: 22,
          &quot;name&quot;: &quot;General&quot;,
          &quot;visible&quot;: 1,
          &quot;summary&quot;: &quot;&quot;,
          &quot;summaryformat&quot;: 1,
          &quot;section&quot;: 0,
          &quot;hiddenbynumsections&quot;: 0,
          &quot;uservisible&quot;: true,
          &quot;modules&quot;: []
      },
      {
          &quot;id&quot;: 23,
          &quot;name&quot;: &quot;Introduction&quot;,
          &quot;visible&quot;: 1,
          &quot;summary&quot;: &quot;&quot;,
          &quot;summaryformat&quot;: 1,
          &quot;section&quot;: 1,
          &quot;hiddenbynumsections&quot;: 0,
          &quot;uservisible&quot;: true,
          &quot;modules&quot;: [
              {
                  &quot;id&quot;: 44,
                  &quot;url&quot;: &quot;http://localhost:8077/mod/assign/view.php?id=44&quot;,
                  &quot;name&quot;: &quot;Assignment&quot;,
                  &quot;instance&quot;: 3,
                  &quot;contextid&quot;: 99,
                  &quot;visible&quot;: 1,
                  &quot;uservisible&quot;: true,
                  &quot;visibleoncoursepage&quot;: 1,
                  &quot;modicon&quot;: &quot;http://localhost:8077/theme/image.php/boost/assign/1613571924/icon&quot;,
                  &quot;modname&quot;: &quot;assign&quot;,
                  &quot;modplural&quot;: &quot;Assignments&quot;,
                  &quot;indent&quot;: 0,
                  &quot;onclick&quot;: &quot;&quot;,
                  &quot;afterlink&quot;: null,
                  &quot;customdata&quot;: &quot;\&quot;\&quot;&quot;,
                  &quot;noviewlink&quot;: false,
                  &quot;completion&quot;: 1,
                  &quot;completiondata&quot;: {
                      &quot;state&quot;: 0,
                      &quot;timecompleted&quot;: 0,
                      &quot;overrideby&quot;: null,
                      &quot;valueused&quot;: false
                  }
              },
              {
                  &quot;id&quot;: 46,
                  &quot;url&quot;: &quot;http://localhost:8077/mod/resource/view.php?id=46&quot;,
                  &quot;name&quot;: &quot;test(.txt)&quot;,
                  &quot;instance&quot;: 24,
                  &quot;contextid&quot;: 102,
                  &quot;visible&quot;: 1,
                  &quot;uservisible&quot;: true,
                  &quot;visibleoncoursepage&quot;: 1,
                  &quot;modicon&quot;: &quot;http://localhost:8077/theme/image.php/boost/core/1613571924/f/text-24&quot;,
                  &quot;modname&quot;: &quot;resource&quot;,
                  &quot;modplural&quot;: &quot;Files&quot;,
                  &quot;indent&quot;: 0,
                  &quot;onclick&quot;: &quot;&quot;,
                  &quot;afterlink&quot;: null,
                  &quot;customdata&quot;: &quot;\&quot;a:1:{s:10:\\\&quot;printintro\\\&quot;;i:1;}\&quot;&quot;,
                  &quot;noviewlink&quot;: false,
                  &quot;completion&quot;: 1,
                  &quot;completiondata&quot;: {
                      &quot;state&quot;: 0,
                      &quot;timecompleted&quot;: 0,
                      &quot;overrideby&quot;: null,
                      &quot;valueused&quot;: false
                  },
                  &quot;contents&quot;: [
                      {
                          &quot;type&quot;: &quot;file&quot;,
                          &quot;filename&quot;: &quot;test.txt&quot;,
                          &quot;filepath&quot;: &quot;/&quot;,
                          &quot;filesize&quot;: 935,
                          &quot;fileurl&quot;: &quot;http://localhost:8077/webservice/pluginfile.php/102/mod_resource/content/1/test.txt?forcedownload=1&quot;,
                          &quot;timecreated&quot;: 1621949734,
                          &quot;timemodified&quot;: 1621949744,
                          &quot;sortorder&quot;: 1,
                          &quot;mimetype&quot;: &quot;text/plain&quot;,
                          &quot;isexternalfile&quot;: false,
                          &quot;userid&quot;: 2,
                          &quot;author&quot;: &quot;ABC&quot;,
                          &quot;license&quot;: &quot;unknown&quot;
                      }
                  ],
                  &quot;contentsinfo&quot;: {
                      &quot;filescount&quot;: 1,
                      &quot;filessize&quot;: 935,
                      &quot;lastmodified&quot;: 1621949744,
                      &quot;mimetypes&quot;: [
                          &quot;text/plain&quot;
                      ],
                      &quot;repositorytype&quot;: &quot;&quot;
                  }
              }
          ]
      }
  ]
  </code></pre>
  <p>I want to get the files from the assignment. Is there a way to achieve this?</p>