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

"Parent grades portal" help

$
0
0
by Doug Stevens.  

Hey all, This seemed to work in an earlier version of moodle, but since moving to 3.7 it doesn't seem to work anymore. The purpose of this is to give parents access to their child's grade book.  When I assign this role manually in the "Roles relative to this user" section of preferences it works perfectly.  However, when the script creates a $roles array with the contents of:

array(528) {
  [0]=>
  array(5) {
    ["roleid"]=>
    int(9)
    ["contextlevel"]=>
    string(4) "user"
    ["userid"]=>
    int(37393)
    ["contextid"]=>
    int(36887)
    ["instanceid"]=>
    int(19846)
  }....

}

Where
  • roleid=9 is a "user" level role to give Parents access to their child's grades.
  • contextlevel="user" implies I want to give this role to a user
  • userid=37393 is the confirmed userid of the Parent
  • instanceid=19846 is the confirmed userid of the Student
  • contextid=36887 is the confirmed context for the student with id=19846

and feed it into the following php method call ($clientm has worked for other method
calls including unrelated calls to core_role_assign_roles):

try{$resp=$clientm->core_role_assign_roles($roles);}catch(Exception$e){echo$e."\n";}

Nothing happens. No PHP errors, and the moodle log shows
"The web service function 'unknown' has been called."

Would love any help!

Thanks,
Doug

Re: enrol_manual_enrol_users without enrolling the web service user

$
0
0
by Massimo Scali.  

In order to enrol a student or a teacher in a course you must authorise the web service client user to assign those roles and this is managed in a reserved tab in the "Role management" page.

Massimo

Moodle: webservice_access_exception

$
0
0
by Berenice Packiavathi.  

I have got this exception when test the Webservice test client in REST.

<?xml version="1.0" encoding="UTF-8" ?> <EXCEPTION class="webservice_access_exception"> <ERRORCODE>accessexception</ERRORCODE> <MESSAGE>Access control exception</MESSAGE> </EXCEPTION>


回复: Re: 回复: core_grades_update_grades: componet and activityid for manual grade item

$
0
0
by spoony liu.  

The correct grade value is posted successfully. However, the feedback string doesn't show. Can you help with this please?

Add cohorts to sync via API

$
0
0
by Константин Викторович Шипулин.  

Hi

You must add data from a cohorts to the Learning plan templates using the API.
Is there such a function?

Re: error when adding external functions to a web service.

$
0
0
by Adam Barker.  

I managed to solve this on my install.

I manage a version of Moodle that has been updated and modified a lot across the years, so was created a long time ago and upgraded a fair few times. 

The issue in my case was a knock on of have the database reference to an old disabled theme. Deleting these themes through the plugin manager resolved this issue.

Find course by Course ID number? (idnumber)

$
0
0
by Alain Benbassat.  

Hi,

How can I find a course by Course ID number using the REST interface?

By course ID number, I mean the field idnumber.

What's the wsfunction I can use and what are the parameters?

Thank you!


Re: Find course by Course ID number? (idnumber)

$
0
0
by Alain Benbassat.  

I found the solution: core_course_get_courses_by_field

wsfunction=core_course_get_courses_by_field&moodlewsrestformat=json&field=idnumber&value=1234

Re: enrol_manual_enrol_users without enrolling the web service user

$
0
0
by Mily Rose.  

In this contemporary world, we all use more than one web service in our day to day life. A web service is any piece of software that makes itself available over the internet. It also can be the communication between electronic devices. click over here

File not accessable overviewfiles

$
0
0
by Nilesh Pathade.  

showing error :  

{"error":"Access control exception","errorcode":"accessexception","stacktrace":"* line 58 of \/webservice\/pluginfile.php: webservice_access_exception thrown\n","debuginfo":"Web service file downloading must be enabled in external service settings\nError code: accessexception","reproductionlink":"http:\/\/52.172.156.103\/iomad\/"}




Array(3)
0:
id: 6
shortname: "Grid Course format"
fullname: "Grid Course format"
displayname: "Grid Course format"
enrolledusercount: 1
idnumber: ""
visible: 1
summary: "<p></p><div><p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p></div><div><br /></div><br />"
summaryformat: 1
format: "grid"
showgrades: true
lang: ""
enablecompletion: true
completionhascriteria: true
category: 3
progress: 100
completed: true
startdate: 1582015500
enddate: 0
marker: 0
lastaccess: 1582709416
isfavourite: false
hidden: false
overviewfiles: Array(1)
0: {filename: "goi_iStock_computer-art.151110.jpg", filepath: "/", filesize: 306925, fileurl: "http://moodlesite/iomad/webservice/pluginfile.…/overviewfiles/goi_iStock_computer-art.151110.jpg", timemodified: 1584597515, …}
length: 1
__proto__: Array(0)
__proto__: Object

Cannot add functions to service

$
0
0
by Son TRAN.  

Dear All,

I just reinstalled Moodle version 3.8.1 build 20200113. Everything seems OK. But when I tried to add some functions to the Moodle mobile web service, I got the the following Error

"Coding error detected, it must be fixed by a programmer: Cannot find file with external function implementation" 

The link to API Documentations gave me the same error message.

So did I miss some files during the installation?

Many thanks


Missing required key in single structure: user For auth_userkey_request_login_url

$
0
0
by Nilesh Pathade.  

Hi All,

I am using auth_userkey_request_login_url  plugin to login with username.

I have developed angular App. 

Using Angular Service I am trying to call auth user key request to login url but it showing me following error.

<?xml version="1.0" encoding="UTF-8" ?>
<EXCEPTION class="invalid_parameter_exception">
    <ERRORCODE>invalidparameter</ERRORCODE>
    <MESSAGE>Invalid parameter value detected (Missing required key in single structure: user)</MESSAGE>
    <DEBUGINFO>Missing required key in single structure: user</DEBUGINFO>
</EXCEPTION>

Please help me for this.

core_user_*: webservice_access_exception or no real data returned

$
0
0
by Mark Dammer.  

I am currently testing an External Service (REST with JSON response) on our test system and I am experiencing problems will all user related API calls (core_user_*):

core_user_get_users /  core_user_create_users: webservice_access_exception

core_user_view_user_list with courseid 0: I am only getting status:true, warnings:[], but not a single user listed.

I switched debug mode to "DEVELOPER", checked what debuginfo suggested and could not find any problems.
Because this is a test system I am using a user for this web service that has the Manager role and all capabilities checked.
Toke authentication works because I am getting authentication errors when changing the token.

Requests to other API functions like core_course_get_courses or siteinfo work fine.

Moodle version is 3.5.3+, build 20181204

Re: core_user_*: webservice_access_exception or no real data returned

$
0
0
by Mark Dammer.  

Problem Solved:
Although the token authentication worked, the token was assigned to the wrong service (mobile web service).

Re: Get roles Webservice API

$
0
0
by Thomas Schröder.  

Hello everyone,

We have users (teachers and students) stored in an ldap tree. We wrote a Flask/Python-tool to synchronize our users cohorts and courses (to moodle and nextcloud simultaneously).

When users are logging in manually they automatically get a role (student). When teachers are logging in, they get the role editingteacher by their ldap group.

The tool will create all users so that we can enrol them to their courses before the term starts. I can see all roles with names and shortnames in https://m.corvi.schule/admin/roles/manage.php and within the database.

But when enroling a user to a course, I need to know the role id (int). And I see no way so far to get this role id using the rest api(e.g. from role shortname).

Any hint/idea? Or maybe another approach to what we would like to accomplish?

So far we are creating a dummy course "role template" with administrator in it. Then we can get the roles from there. But this has to be done manually - so another solution would help us a lot.

Thanks
Thomas



REST-API: Create new users via auth_email_signup_user

$
0
0
by house master.  

Hi,

I want to add new users to our moodle system in a webapp via the REST-API. Since you need to be logged in for "core_user_create_users" to work, I thought "auth_email_signup_user" would be the correct function. But here I always get the "Invalid parameter value detected" error... The API documentation says I need a username, password, firstname, lastname and email parameter, but it won't work:

https://<moodle>/webservice/rest/server.php?wstoken=xyz&wsfunction=auth_email_signup_user&moodlewsrestformat=json&username=test&password=xyz&firstname=house&lastname=master&email=house@xyz.com

The parameter format for core_user_create_users is "users[0][firstname], users[0][lastname]" etc. but this won't work either. 

Any ideas what I am doing wrong?

Re: REST-API: Create new users via auth_email_signup_user

$
0
0
by house master.  

Ok it's working now. I enabled the developer debug messages and it told me I forgot to pass the parameters of the custom profile files, which were mandatory as well.
If anyone wonders how to pass multiple custom fields:
&customprofilefields[0][type]=string&customprofilefields[0][name]=profile_field_NAME&customprofilefields[0][value]=placeholder&customprofilefields[1][type]=string&customprofilefields[1][name]=profile_field_NAME2&customprofilefields[1][value]=placeholder

...but now I have to confirm the user and don't know the "secret" parameter. Anyone knows how to get that one?
The function I'm using is core_auth_confirm_user, which requires the username and the secret.

Re: "Parent grades portal" help

$
0
0
by Doug Stevens.  

Hey all, just replying to move this up. Wondering if anybody has any ideas? The call doesn't return any error except to say that function "unknown" has been called. Other method calls through $clientm work fine, just not this one. As far as the docs go, this looks right:
XML-RPC (PHP structure)

[assignments] => Array
(
[0] => Array
(
[roleid] => int
[userid] => int
[contextid] => int
[contextlevel] => string
[instanceid] => int
)
)

Any thoughts?

Re: "Parent grades portal" help

$
0
0
by Doug Stevens.  

Solved:
The script included two subsequent role assignments. The first one gave parents access to view the content in their child's course, the second one gave them the ability to view their child's grades. Running them as two method calls triggered the error. When I put both data sets in the same array and made a single call to core_role_assign_roles it worked. Still not sure why that would happen, but it solved the problem.

Thanks all
Doug

mod_assign_get_grades doesnt return optional value

$
0
0
by Hernán Anskaitiene.  

Hello, I am testing to get student grades using mod_assign_get_grades service.
I have managed to get the assignment results but the "gradefordisplay" field does not show it.

At first I thought that there was no showing it because of a permission issue.
I then tried the gradereport_user_get_grade_items service and that way I was able to get the "gradeformatted".

I got to see the mod_assign_get_grades service source code and couldn't find it referring to the optional field.

Could it be missing including it in the service?

Thanks in advance.

Viewing all 2361 articles
Browse latest View live


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