llagerlof / MoodleRest

MoodleRest is a PHP class to query Moodle REST webservices
MIT License
86 stars 21 forks source link

invalid argument error #3

Closed maryamMOMENII closed 3 years ago

maryamMOMENII commented 3 years ago

hi i want to use this function core_course_get_courses_by_field and send request with examlpe2 in this package doc. $MoodleRest->request('core_course_get_courses_by_field', array( array('field'=>'idnumber','value'=>'111111111')), \MoodleRest::METHOD_GET);

and then get error invalid argument. everyone can help me ... Thank you in advance

llagerlof commented 3 years ago

You have an extra array that should not be there. I made a test right now. This is the correct syntax for this webservice function:

$MoodleRest->request('core_course_get_courses_by_field', array('field'=>'idnumber','value'=>'111111111'));

One detail: If your request is a GET, you don't need to explicit it.

llagerlof commented 3 years ago

Closing this issue, assuming @maryamMOMENII already fixed the syntax and moved on.