Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2364

Invalid-parameter errorr from apparenly valid user and group IDs passed to core_group_add_group_members

$
0
0
by Jocelyn Ireson-Paine.  

I'm trying to call the core_group_add_group_members Web service, but getting an invalid-parameters message for apparently valid user and group IDs.

I'll show the program at the end of this posting.

If I call it with an invalid group ID but a valid user ID, I get an error with exception class "dml_missing_record_exception", errorcode "invalidrecord", and message "cannot find data record in database table groups".

If I call it with a valid group ID but an invalid user ID, I get an error with exception class "dml_missing_record_exception", errorcode "invaliduser", and message "invalid user".

The fact that it can detect invalid groups and users suggests to me that I am calling it correctly.

But when I pass it a valid user ID and a valid group ID, I get the "invalid parameter value detected" exception.

So when the user and group are OK, it seems not to like the format in which I've passed them, or something.

This is my code:

$group_id = 21;

$user_id = 149;

$params = "&members[0][groupid]=" . $group_id . "&members[0][userid]=" . $user_id;

$token = 'bbb86beefd82sttewsdef5fd9ef1b3e7c3';

$url = "my_moodle.com";

$serverurl = $url . '/webservice/rest/server.php?wstoken=' . $token . "&wsfunction=core_group_add_group_members";

require_once( './curl.php' );
$curl = new curl;

$response = $curl->post( $serverurl, $params );

echo "Response = \n", $response, "\n";

Jocelyn


Viewing all articles
Browse latest Browse all 2364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>