by Berk Eren KOCA.
Hi, I'm trying to delvelop a system which consumes some of the Moodle's web services. In this system there are 3 steps related with the Moodle's web service which are:-Get all the courses belong to Instructor
-Get all the assignments belong to selected course
-After editing the assignment, update it with the latest one.
I easily implemented first two of them but updating an assignment is the problematic part. When I use local_o365_update_onenoteassignment function, it returns "Invalid Parameter Value Detected" error although parameters are correct. Here is my code below. I appreciate it if you help me.
String token = "adcd621f420dfc3000f106a6ebcebccb";
String domainName = "http://localhost:81/moodle";
String functionName = "local_o365_update_onenoteassignment";
String urlParameters = "data[coursemodule]= "+CurrentAssignment.getCourseModuleID()+
"&data[course]="+Course.getCurrentCourse().getCourseId()+
"&data[name]="+CurrentAssignment.getAssignmentName()+
"&data[intro]="+CurrentAssignment.getIntro()+
"&data[section]= 0"+
"&data[visible]= 1";
String restformat = "&moodlewsrestformat=json";
String serverurl = domainName + "/webservice/rest/server.php" + "?wstoken=" + token + "&wsfunction=" + functionName;
HttpURLConnection con = (HttpURLConnection) new URL(serverurl).openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
con.setRequestProperty("Content-Language", "en-US");
con.setDoOutput(true);
con.setUseCaches (false);
con.setDoInput(true);
DataOutputStream wr = new DataOutputStream (
con.getOutputStream ());
wr.writeBytes (urlParameters);
wr.flush ();
wr.close ();