trying to do the same for my site here
Re: Create Web service for android
Re: lightwork setup problems (no functions) Help! moodle 2.4
Hi Lewis,
The web service functions that would allow you to use Lightwork with the new assignment type are still under development and so Lightwork cannot yet be used with the new assignment module.
Some of these functions are described in the section "The new Lightwork web services" in the development document that you refer to. Note that these functions do not contain the text "lightwork" since they are designed to be generic functions that can be used by anyone, not just Lightwork (your screenshot shows one of these functions - core_enrol_get_enrolled_users_with_capability).
The current version of Lightwork (3.1.X) can only be used with the OLD 2.2 assignment type.
When all the new web services are completed and integrated into Moodle, a new 4.1.X version of Lightwork will be made available that can be used with the new assignment type.
Paul
Errorcode setting_locked_by_permission when calling core_course_duplicate_course
Hi. I'm back after an absence of about a year and a half, now working with Moodle 2.5. I'm trying to copy a course using the core_course_duplicate_course Web service, but am getting a "base_setting_exception" with the errorcode "setting_locked_by_permission".
My code is at the end of this posting. Most of it is copied from the test example in MDL-34085: Fix the backup options names in core_course_duplicate_course. I'm therefore pretty confident that it's OK. If I give it a non-existent course ID, it tells me so, indicating that it is finding the Web service and the courses in our Moodle. I'm not very familiar with using and administering Moodle, as distinct from programming it, so I want to know whether I might need to set some permission that allows courses to be copied, or to unset some default that prohibits it. Perhaps I need to set a permission on the courses? I can't see anything when I examine them, though. I have given our Web service role every permission that Moodle allows, by ticking all the boxes when I edit it.
This is my code:
define( "MOODLE_URL", "moodle.me.com" ); define( "TOKEN_FOR_BUILT_IN_FUNCTIONS", 'bb586d9beef2c289af91fd9e4stewe7c3' ); $params = array( 'courseid' => 5, 'fullname' => 'core_course_duplicate_course test', // New course full name 'shortname' => 'core_course_duplicate_course', // New course shortname 'categoryid' => 1, // New course category id 'visible' => 1, // Make the course visible after duplicating 'options' => array( array('name'=>'blocks', 'value'=>1) , array('name'=>'activities', 'value'=>1) , array('name'=>'users', 'value'=>1) , array('name'=>'userscompletion', 'value'=>1) , array('name'=>'grade_histories', 'value'=>1), ) // Backup options ); $function_name = 'core_course_duplicate_course'; $token = TOKEN_FOR_BUILT_IN_FUNCTIONS; $serverurl = MOODLE_URL . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction=' . $function_name; require_once( './curl.php' ); $curl = new curl; $response = $curl->post( $serverurl, $params ); echo $response;
And this is its output:
<?xml version="1.0" encoding="UTF-8" ?><EXCEPTION class="base_setting_exception"><ERRORCODE>setting_locked_by_permission</ERRORCODE><MESSAGE>error/setting_locked_by_permission</MESSAGE></EXCEPTION>
Any ideas?
Re: Uploading files as an assignment via a webservice?
Hi,
Some how i found solition via
http://docs.moodle.org/dev/Web_services_files_handling
but this upload at private files not at assignment ,
do anyone have any idea how to upload file in assignment via webservice in 2.3 and later
Is enrol_manual_unenrol_users() in Moodle 2.5?
Is enrol_manual_unenrol_users() in Moodle 2.5? I worked out some code for it which I posted in my Wny are there enrolment plugins instead of a function for enrolment and a function for unenrolment? thread. Fábio Souto took this up in Moodle / MDL-29934 Web service API Roadmap / MDL-30063 enrol_manual_unenrol_users(). From the comments there, I see that Fabio and Jérôme have tested it, and Rajesh Taneja has recommended a few changes. I've found that I need unenrolment in the new project I'm doing, but didn't see a Web-service function in Moodle 2.5. I couldn't see from the MDL what the state of affairs now is.
Jocelyn
webex
Hi!
Would you please tell me how can I install Webex in Moodle??
Re: Error while calling core_user_create_user
I've got the same issue. Definitely a bug for those who would like to use CAS and Web Services without configuring LDAP.
Any update? Did you manage to solve the issue? What did you do?
Cheers, Tim
Webex
Nobody can answer me???????
I cant install Webex in Moodle...I really need it!
Re: Error while calling core_user_create_user
I think I have found the cause of this problem, and I have filed a bug with a proposed solution:
Invalid-parameter errorr from apparenly valid user and group IDs passed to core_group_add_group_members
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
Re: Quiz web services available as local plugin
Hey, any plans of contributing the quiz api plugin?
We would love to look at the code and make improvements (and also use it )!
Local Web Service
I've created a local web service based on core_enrol_get_enrolled_users. It works almost perfectly, for some reason the Username field shows up as:
<KEY name="username">
<VALUE null="null"/>
</KEY>
This is a REST request, on Moodle 2.3. I wondered if I had just missed something but if I use the token to call core_enrol_get_enrolled_users it does the same thing. Is this a permissions problem? Maybe my WSuser isnt' allowed to view usernames?
Thanks for any help.
Re: Local Web Service
If I grant the WSUSER account site admin priveleges this starts working, take it away and it shows the above. Not sure what permission I'm missing because the user has all the perms required to run the web service (and there are no permission errors during run).
Re: Errorcode setting_locked_by_permission when calling core_course_duplicate_course
Dear @ Jocelyn Ireson-Paine
I am not have many years experience in Moodle.
But my working with same web service.
As per my experience, You need to assign role from user->role
and also from web services->
http://docs.moodle.org/20/en/Using_web_services
Best of luck.
Using same code I am facing error
Notice: Array to string conversion in ....\moodle\bpms\lib\filelib.php on line 3000
Any one have any idea please share.
core_course_duplicate_course (Web Service)
Dear members and seniors
May you all live in peace!
Today, while working with core_course_duplicate_course (web service). I am error given below.
"Notice: Array to string conversion in moodle\bpms\lib\filelib.php on line 3000
invalidparameter Invalid parameter value detected options => Invalid parameter value detected: Only arrays accepted. The bad value is: 'Array'"
My Code is here in below:-
require_once( '../../../lib/zend/Zend/Http/Client/Adapter/Curl.php' );
define( "MOODLE_URL", "http://localhost/bpms/" );
define( "TOKEN_FOR_BUILT_IN_FUNCTIONS", '1e5deac8a0ba32dc542ad7add11df5' );
$params = array(
'courseid' => 4,
'fullname' => 'core_course_duplicate_course test', // New course full name
'shortname' => 'core_course_duplicate_course', // New course shortname
'categoryid' => 1, // New course category id
'visible' => 1, // Make the course visible after duplicating
'options' => array( array('name'=>'blocks', 'value'=>0)
, array('name'=>'activities', 'value'=>1)
, array('name'=>'filters', 'value'=>0)
, array('name'=>'users', 'value'=>0)
, array('name'=>'userscompletion', 'value'=>0)
, array('name'=>'grade_histories', 'value'=>0)
) // Backup options
);
$function_name = 'core_course_duplicate_course';
$token = TOKEN_FOR_BUILT_IN_FUNCTIONS;
$serverurl = MOODLE_URL . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction=' . $function_name;
$curl = new curl;
$response = $curl->post( $serverurl, $params );
echo $response;
I am using core_course_duplicate_course (Web Service) with stable Moodle 2.3. version. I applied all changes, roles, user token, web service use procedure. All done.
bt why this error occur.
filelib.php code from 2977 to 3003 lines
curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this,'formatHeader'));
// set headers
if (empty($this->header)){
$this->setHeader(array(
'User-Agent: MoodleBot/1.0',
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Connection: keep-alive'
));
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->header);
if ($this->debug){
echo '<h1>Options</h1>';
var_dump($this->options);
echo '<h1>Header</h1>';
var_dump($this->header);
}
// set options
foreach($this->options as $name => $val) {
if (is_string($name)) {
$name = constant(strtoupper($name));
}
curl_setopt($curl, $name, $val);
}
return $curl;
}
Waiting for your positive response.
What software is a good fit with Moodle to stream content
What software is a good fit with Moodle to stream teaching
content(Mp3 and Mp4) that we currently have and anything
new we would like to added. What can you recommend either
free or pay for software as a service? Thank you for any direction.
Re: Enrol Teacher to a course
This was very helpful.
How can I check if a user is already enrolled into a course so that I don't call the affect_user_to_course again?
Webservice- functions for mobile application
Hi All,
I am trying to create a mobile application for Moodle. I am able to get the courses and course details using the functions core_course_get_courses and core_course_get_contents.
But I also need to get the completion status of a course. Is there any function which provides this detail? Also does anyone have an idea on how to implement paging during fetching courses(core_course_get_courses)
Thanks in advance
Limitation of SOAP Connections
Hi,
I'm using a PHP Script to create Courses and add/remove Users to Moodle 2.4 trough the SOAP Webservice.
It works great for a small amount of Courses, but breaks if there are too many Courses. The Script sends hundrets of Soap Calls.
After a while the script breaks with the message:
PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in ...
There is no problem if i split the script into pieces (not more than 50 Courses at once) so the Host URL is correct an Soap functions work correctly.
Are there any limitation? For examle: Not more than 500 Soap Requests per Hour - or something else?The PHP Script is running on CLI with no memory Limit
Thanks for your help.
Re: Create a web service for a block type plugin
Yes you can. You can use moodle default web services as base and overwrite them according to your need.
It just passing web service token from moodle to our code.