Hey Karishma,
Try this link http://xxx/x/login/token.php?username=admin&password=***&service=shortname.
If this link generate a token same as that of the token generated by you previously then your token is correct.
Regards,
Mayank
Hey Karishma,
Try this link http://xxx/x/login/token.php?username=admin&password=***&service=shortname.
If this link generate a token same as that of the token generated by you previously then your token is correct.
Regards,
Mayank
Hey guys,
I have been recently learning about ip addresses and i came across a term called as proxy server. Can someone please help me with what actually is proxy server and how to i use it?
Hello
I have LMS Moodle In that, I am using Moodle API by php curl
For that,
1) I have Created a User role and assign permission to that role.
2) Create user and assign that user to a created role
3) also create External Service by that user.
4) after that generate a token to access API
I am able to create a course by that generated token
but unable to update course and getting an error "core_course_update_courses: accessexception Access control exception"
I am using core_course_update_courses
I am Using curl class
https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php
Api endpoint url
$serverurl ="https://elearning.tsfx.com.au/webservice/rest/server.php?wstoken=api_token&wsfunction=core_course_update_courses";
require_once( 'curl.php' );
$course = new stdClass();
$course->id = $course_id;
$course->fullname = 'testcourseupdate' . $n;
$course->shortname = 'testcourseupdate' . $n;
$course->categoryid = 3;
$courses = array( $course );
$params = array( 'courses' => $courses );
$curl = new curl;
$response = $curl->post( $serverurl, $params );
Getting error Response from core_course_update_courses: accessexception Access control exception
please provide me with some suggestions.
Hello, In our organization we are using Moodle 3.6 based E-Training portal for our employees, as we are using Oracle based HRMIS system for all Employees HR processes , now we have a challenge as the management required to integrate both systems in the way that all employee training accomplished and activities auto reflected in his HRMS profile, as well as announcing concerned staff when new employee joined to start essential training courses.
So is there is any API or Webservices solution to fulfill this integration, thanks and best regards,
Hi, I found this article on IP Addresses and it was quite helpful, explained a lot.
Hey Karishma,
If you want to add rest parameter for GET/POST you can do it by this.
http://example.com/webservice/rest/server.php?wstoken=4d58eb874d279fd220e9&wsfunction=location_webservices_create_variant&moodlewsrestformat=json&group_idnumber=97&name=Full Week&course_idnumber=toefl&location_idnumber=99
I am working on a project where i am using moodle quiz feature. and I am using below mentioned webservice all are working but except (mod_quiz_save_attempt)
mod_quiz_start_attempt // working and getting response correctly
mod_quiz_save_attempt // not working from yesterday , but getting response without any error
. . . etc
Reponse of 'mod_quiz_save_attempt' webservice:
{
"status": true,
"warnings": []
}
But answers are not saving into the database
Any help please.
Hello,
the way you should pass data back to the web service is different from a plain JSON object: see an example about another web service in https://moodle.org/mod/forum/discuss.php?d=380406#p1533429 .
HTH,
Matteo
How to develop custom web services in moodle.
Thanks for the reply
I checked the same. But getting same problem ...
my code is ///
require_once('./curl.php');
$token = 'mytoken';
$functionname = 'mod_quiz_save_attempt';
$domainname = 'http://localhost/moodle';
$restformat = 'json';
$params=array('attemptid'=>1 , 'data' => array (array('name' => 'slot','value' => 1 ),array('name' =>'q1:1_:sequencecheck','value' => 1),array('name' =>'q1:1_answer','value' => 2)), 'preflightdata' => array (array('name' => "",'value' => "")));
$functionname = 'mod_quiz_save_attempt';
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname;
$curl = new curl;
$restformat = ($restformat == 'json')?'&moodlewsrestformat=' .$restformat:'';
$resp = $curl->post($serverurl . $restformat, $params);
print_r($resp);
Please check ... Thanks in advance
What is the use of curl.php . in custom moodle web service plugin
I developed a custom web service, when i am adding function to the service created function is not in the drop down.
Hello,
Is it possible to enrol users in a course by REST web service without previously manually enrolling the web service user in that course ?
I have to create a lot of courses in Moodle and i must enrol teachers and students in these courses.
I would like to do this by the web service API.
I can easily create courses with REST.
But i cannot enrol teachers in that course with enrol_manual_enrol_users, i have an exception :
<EXCEPTION class="require_login_exception">
<ERRORCODE>requireloginerror</ERRORCODE>
<MESSAGE>Cours ou activité pas accessible.</MESSAGE> "Course or activity not accessible"
</EXCEPTION>
The only way i found to enrol a teacher with enrol_manual_enrol_users is to manually enrol the web service user in the course. Is there a solution to get around that problem in order to have a complete automatic process ?
Thanks.
How can i create a user via web srvice.
Moodle Mobile tools /admin/tool/mobile | 2017111300 | 2017111300 |
|
Appears you have/running version 3.4.x of Moodle.
Please go to http(s)://yourserver/admin/settings.php?section=mobilesettings and see how that's set.
cat ./moodle34/admin/tool/mobile/version.php
shows:
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017111300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2017110800; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
'webservice_rest' => 2017110800
So it's related to mobile.
'spirit of sharing', Ken
Hi All,
I'm using the web services api and I want to update a timeopen date programmatically. I don't see which api will allow me to do that? Any suggestions?
Thanks so much.
Randy
cat ./moodle34/admin/tool/mobile/version.php
shows:
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017111300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2017110800; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
'webservice_rest' => 2017110800
_____________________________________________________________________________
I can see as you have shown the error and the need for a change in the mobile/version.php but I have tried to figure out how this change came about and why. I am not a programmer but an administrator for several moodle sites and want to prevent this from happening in the future as well as get this code fixed. Any suggestions?
David
And when you went to
http(s)://yourserver/admin/settings.php?section=mobilesettings
as suggested earlier you saw what?
Think Moodle 3.4.x had a bug in it related. Have a 3.4.highest for testing purposes and have no such issue. But accessing the area above does produce some 'red' warnings about certificate not being valid ... uhhhh, not true.
If desiring to keep the 3.4.x you have, download locally the 3.4.x code, unzip locally, and compare what's in the unzipped archive with what's in one of your instances of Moodle on server.
On my server, error in a 3.5.x or 3.6.x. not present.
Fix? Time to upgrade?
As far as why/how that happened ... sorry, no Vulcan Mind Meld possible on this end! :|
'spirit of sharing', Ken
Hi Matteo, Please check the code , where I am doing wrong and If I hit same web service with same code in locally(moodle project deployed locally) it is working ... but it is not working in production(moodle project deployed) and before some fews days back it was working fine, please reply asap