General developer forum

i want Student details using java API

 
Picture of Abhijeet Nipane
i want Student details using java API
 

hello,

i want Student details like student name, Email etc. to notify them about exam related activity. i am using java to develop my application. but i am not getting which web service function and API I have to use to get these details. please help me if someone have any idea regarding this.

thank you.


 
Average of ratings: -
Picture of Mark Johnson
Re: i want Student details using java API
Core developersParticularly helpful MoodlersPlugin developers

Does core_user_get_users (or maybe core_user_get_users_by_field/core_user_get_users_by_field) get you what you need?

https://docs.moodle.org/dev/Web_service_API_functions


 
Average of ratings: -
Picture of Abhijeet Nipane
Re: i want Student details using java API
 

Hey Mark,

I want to know how to use these function in java Rest API. I have the moodle generated token for these functions but I am not getting how to utilized  these function and Token using Jave rest API.I use following API :

http://MyMoodle/webservice/rest/server.php?wstoken=c4baecc7068f9cda710199c4a72c02a5&wsfunction=core_user_get_users&moodlewsrestformat=json


This gives me following Error : 

{
"exception": "invalid_parameter_exception",
"errorcode": "invalidparameter",
"message": "Invalid parameter value detected"
}

I even use core_enrol_get_enrolled_users function still getting Error. 

so please help me which API I should use?

 
Average of ratings: -
Picture of Mark Johnson
Re: i want Student details using java API
Core developersParticularly helpful MoodlersPlugin developers

Based on that error message you aren't sending the correct parameters to the function.  If you visit https://YOURMOODLE/admin/webservice/documentation.php you can see the full documentation for the function and the parameters it's expecting.

As an example, with core_user_get_users it's expecting you to send POST data that looks something like:

criteria[0][key]=username&criteria[0][value]=bob01

or with core_user_get_users_by_field it's expecting

field=username&values[0]=bob01

 
Average of ratings: -
Picture of Azmat Ullah
Re: i want Student details using java API
 
Hi Abhijeet,


I'm also getting same error while passing correct parameter. Below are the code.


$functionname = 'core_enrol_get_enrolled_users';


$params = array('courseid' => 64, 'options' => array());


// SOAP CALL

$serverurl = $domainname . '/webservice/soap/server.php'. '?wsdl=1&wstoken=' . $token;


////Do the main soap call

$client = new SoapClient($serverurl);

try {

$resp = $client->__soapCall($functionname, array($params));

} catch (Exception $e) {

    print_r($e);

}

if (isset($resp)) {

    print_r($resp);

}


Thank you.


 
Average of ratings: -