Moodle Web Service: core_enrol_edit_user_enrolment function is deprecated in version 3.9.2

Moodle Web Service: core_enrol_edit_user_enrolment function is deprecated in version 3.9.2

napisao/la Mangesh Nadekar -
Broj odgovora: 2

Hi Team,

I am using Moodle version 3.9.2 and Moodle web service documentation https://docs.moodle.org/dev/Web_service_API_functions for my development.

I want to update user enrolment end timestamp but in API documentation /admin/webservice/documentation.php  core_enrol_edit_user_enrolment function is deprecated.

Message : ** DEPRECATED ** Please do not call this function any more. External function that updates a given user enrolment

Can any one tell how can I update user enrolment end timestamp? or suggest me the alternative API function or any approach.

Thanks,

Mangesh

Prilog Web-services-API-Documentation.png
U odgovoru na Mangesh Nadekar

Re: Moodle Web Service: core_enrol_edit_user_enrolment function is deprecated in version 3.9.2

napisao/la Renaat Debleu -
Slika Core developers Slika Particularly helpful Moodlers Slika Plugin developers
The file lib/upgrade.txt is explaining what changed since 3.8:

=== 3.8 ===
* The core_enrol_edit_user_enrolment webservice has been deprecated. Please use core_enrol_submit_user_enrolment_form instead.
U odgovoru na Renaat Debleu

Re: Moodle Web Service: core_enrol_edit_user_enrolment function is deprecated in version 3.9.2

napisao/la Mangesh Nadekar -

Thanks Renaat for your quick reply.

I have check that the file lib/upgrade.txt is explaining what changed since 3.8.

But it is giving below error which I have mentioned in https://moodle.org/mod/forum/discuss.php?d=412503


Here is my API Request:

$parameters['formdata'] = http_build_query(array( 'ue' => 94, 'ifilter' => '', 'status' => 0, 'timestart' => array( 'day' => 19, 'month' => 10, 'year' => 2020, 'hour' => 14, 'minute' => 15, 'enabled' => 1 ), 'timeend' => array( 'day' => 19, 'month' => 12, 'year' => 2020, 'hour' => 14, 'minute' => 15, 'enabled' => 1 ) ));

$users = $MoodleRest->request('core_enrol_submit_user_enrolment_form', $parameters);

echo '<pre>'; print_r($users); echo '</pre>';


Response:

Array
(
    [exception] => invalid_parameter_exception
    [errorcode] => invalidparameter
    [message] => Invalid parameter value detected
)

Can you correct me in above request parameters.

Thanks,
Mangesh