Error - Web Services - No access rights in module context

Error - Web Services - No access rights in module context

by Usaamah Patel -
Number of replies: 0

Hi I am running the following code in PHP (Curl), However on execution of the code below:

<?php


$curlint = curl_init();


curl_setopt($curlint,CURLOPT_URL,'http://localhost/Project/moodle/webservice/rest/server.php?wstoken=cc1a302430c43a8b2df5bfee7d4ebc56&wsfunction=mod_assign_get_grades&assignmentids[0]=1&moodlewsrestformat=json');


$run = curl_exec($curlint);


curl_close($curlint);


if (empty($run)){

      print "Nothing returned from url.<p>";

  }

  else{

      print $run;

  }

?>


I get the following error:


{"assignments":[],"warnings":[{"item":"assignment","itemid":1,"warningcode":"1","message":"No access rights in module context"}]}1


I have had a look at the assignment id in the mod_assign table in the database and it shows as 1, I have no idea where I am going wrong?

Average of ratings: -