Quantcast
Channel: Web services
Viewing all 2361 articles
Browse latest View live

PowerShell Module

$
0
0
by Matt Hamilton.  

Hi gang,

Thought I'd post here since if you're using web services you might also be a PowerShell wonk like me.

I've created a Moodle module that uses the web services. We've been using it in production for the better part of this year with no issues. We use it to provision new users and enrol them in courses.

The module is open source and I'm happy to take suggestions (or pull requests) if there's functionality you need! You can find it on GitHub here: https://github.com/WodongaTAFE/PSMoodle and install it from the PowerShell Gallery using Install-Module.

Cheers,
Matt


Coldfusion with Angular and Moodle

$
0
0
by Thomas Culver.  

Hello, I am a developer attempting to integrate Moodle with Java& Coldfusion and possibly with an Angular front-end. The website is an online real estate school, https://www.vaned.com/. Anyone have experience with integrating with Java or Coldfusion?

Ri: enrol_manual_enrol_users without enrolling the web service user

$
0
0
by Brunetto Spinelli.  

Searched in google for this without solution, so I did it by myself.

Short answer:
the user you use for your webservices need to allow the following capability:
moodle/course:view
(you need to allow moodle/role:assign too)

Long answer:
Probably you created a new role for handle webservices, based on user archetipe. You added all the needed capabilities (ie: enrol/manual:enrol to enrol users), but you get the error code: requireloginerror.
This happens because the function enrol_users (enrol\manual\externallib.php) calls the function require_login (lib\moodlelib.php). In require login, variable $access must be true or the require_login_exception will be trown.
A way require_login set to true $access is with function is_viewing (lib\accesslib.php):

if (is_viewing($coursecontext, $USER)) {
// Ok, no need to mess with enrol.
$access = true;
}

Now, if you check function is_viewing, there is:
if (!has_capability('moodle/course:view', $coursecontext, $user)) {
// admins are allowed to inspect courses
return false;
}

So adding capability moodle/course:view to your webservice user should achieve the task.

Hope it helps.

Re: Displaying "plugin files" publicly

$
0
0
by Doug Henner.  

...ok after all it works that way.

Error: Scalar type expected, array or object received using core_course_get_courses

$
0
0
by Ben Kahn.  

Hi Moodlers, I'm using integration that syncs our Moodle courses into their system. It was working in the past but last Spring our courses would no longer sync and we had to create courses manually. Using Postman we tested and got the following error output back. I get this on both my production and dev webservers:

{"exception":"invalid_response_exception","errorcode":"invalidresponse","message":"Invalid response value detected","debuginfo":"courseformatoptions => Invalid response value detected: value => Invalid response value detected: Scalar type expected, array or object received."}

I've looked at the course format options table in my database and don't see anything strange. I've also tried on a fresh install of Moodle, installed the additional course formats that match my Moodle site and am not able to reporduce the issue. I'm hoping someone might have an idea of how to troubleshoot further?

Re: Error: Scalar type expected, array or object received using core_course_get_courses

$
0
0
by Ben Kahn.  

Sorry, I should add I'm using Moodle 3.6 and token authentication.... I can take the same query on a test site like:

mysite.com/moodle/webservice/rest/server.php?wstoken=tokenhere&wsfunction=core_course_get_courses&moodlewsrestformat=json

and it works fine on a test site, but not on my production or staging sites...

Re: Error: Scalar type expected, array or object received using core_course_get_courses

$
0
0
by Eloy Lafuente (stronk7).  

Hi Ben,

I've been looking to the WS (external function implementation) and those "courseformatoptions" are an array of name and value (scalar) pairs since 2012 and haven't seen any change there, so far.

My only bet is that the course format being used in some of your courses... maybe is returning some "value" as object or array? Maybe that allows you to investigate a bit further? Which course format are you using, is it a core one or maybe some plugin one?

Ciao smile

Re: Error: Scalar type expected, array or object received using core_course_get_courses

$
0
0
by Ben Kahn.  

Hi Eloy,

I haven't 100% succeeded yet but tentatively it looks like the issue is from unsupported characters that have made their way into the value field in the mdl_course_format_options table. In my case I am using the Kickstart course format plugin which lets you add custom instructions with formatted text for a course teacher or student in the format settings. Looks like some of the text in the value field ended up containing junky characters like the copyright symbol, umlauts, etc. I removed these in my dev site and the scalar type error disappeared. Working on updating the fields in my production site to hopefully reseove the issue.

Re: REST-API: Create new users via auth_email_signup_user

$
0
0
by Lucas Macedo.  

Have you gotten the "secret" parameter? I have not found any documentation on how to get it, I also need to use the core_auth_confirm_user function

Cant find API functions for global groups

$
0
0
by We Be.  

Hi

I can't find a way to read out membership of global groups via webservices.

Any Idea, how to do that?

Thanx,
WE

enrol to categories

$
0
0
by We Be.  

Cant find the web service (API Call) to enrol to categories.


An idea?


thx

We

Re: enrol to categories

$
0
0
by We Be.  

If found a solution with the API-Call : core_role_assign_roles

roleid=...

userid=...

contextlevel ="coursecat";

intanceid = categoryid;


thanks

REST API and Deep Links

$
0
0
by Thomas O'Connor.  

Is there a web service api call that lets you create deep links?

group vise reports

$
0
0
by Mariam Akram.  

how can i download groups with their assigned teachers each of then in a perticular course.

Re: core_grades_update_grades: componet and activityid for manual grade item

$
0
0
by Jesus Marquez.  

Hi Roberto,

Did you achive updating a student manual item?

Thanks.


core_group_get_activity_allowed_groups giving errors

$
0
0
by Sarita Phoosopha.  

Hi, 

I am using Rest to call the 

core_group_get_activity_allowed_groups function, but I keep getting the error {'exception': 'moodle_exception', 'errorcode': 'guestsarenotallowed', 'message': 'The guest user is not allowed to do this'} even though I am an admin. 

I have made sure that REST is enabled and I am able to call other functions such as 
core_group_get_course_user_groups which requires a login as well. 

I'm not really sure why else I am getting this error. 

Re: "No permission to create web service token for the service" with custom service

$
0
0
by Sarita Phoosopha.  

Hey, I was wondering how you fixed the problem of a site admin not being able to create a token? I might be having a similar problem.

Re: "No permission to create web service token for the service" with custom service

Retrieving Quizzes from Moodle through Web Services

$
0
0
by Shehan Senanayake.  

Hi,

I'm currently using Web Services to retrieve the contents from Moodle to my Flutter app. However I can't seem to retrieve questions and answers. Is there an API I can use for this. I would also want to record the answers that the participants make on the quiz back to Moodle. 

The access and authentication part is done so I don't have an issue with identifying who is filling the quiz. 

Let me know if this is possible.

Thanks

Re: "No permission to create web service token for the service" with custom service

Viewing all 2361 articles
Browse latest View live


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