I've added the all functions in Custom Service as external service. When I tried to test the function, I could fund the functions that I've added at Web Service Test Client. Check the screenshot below;
Missing functions at Web Service Test Client
GET request: core_course_get_courses
Hi,
I'm making the following GET request in postman: ...?wstoken=********&wsfunction=core_course_get_courses and it's returning all 8 courses that I have set up in Moodle for testing and the user token that I'm using in the URL is only enrolled to 7 of them.
Is there a way to only return the users courses that they're enrolled in?
Thanks,
Chris
Re: GET request: core_course_get_courses
It sounds like you want to use the core_enrol_get_users_courses web service
Why does a category idnumber return null?
I use the Moodle API and GetToken to log-in with a user. Then I retrieve the categories information here:
api.GetCategories(siteInfo.Userid, categories =>
{
DataManager.Instance.categories.Clear();
if (categories.Length > 0)
{
foreach (var category in categories)
{
// Save category info.
Debug.Log(category.Idnumber);
DataManager.Instance.categories.Add(category);
}
}
queuedRequestCount--;
});
However, category.Idnumber returns null. It shouldn't be null, it's definitely filled in.
Is it an issue with account privilege? Or what could it be..?
Thank you.
Post payload didn't send to Web Service via RAW/JSON
Hello,
I try to make a request via POST to Moodle Web Service API but the payload didn't send to web service, only url.
If i try to send my parameters via GET it works.
Is there a place where I have to configure it to enable sending the payload in raw / json format?
Re: core_user_get_users_by_field return blank array
Yes, this is the solution. Thank You! Give the capacity "Moodle/user:viewalldetails" to the rol of web services.
Only number ID at token
web services with personal access token
when use moodle_mobile_app web service i can user user token to access any function on it
but when i create any web service i must create a client token
i need to create web service and use user token like moodle_mobile_app
how can i do that ?
Rest Web Service - Getting List of System Cohorts
Hello,
I'm trying to use Moodle Rest Web Service to get a list of all system cohorts so that I can compare it with a list from outside moodle and then update the cohort to match that list if it does not match.
I'm currently caught up on the first step though as I'm not sure how to get the list of cohorts. I'm trying to use the "core_cohort_search_cohorts" but am not sure how to use the context array parameter.
Currently I'm trying to use the default options from the generated documentation of [0,'',0] but it still returns the error of:
{ exception: 'invalid_parameter_exception', errorcode: ' invalidparameter', message: 'Invalid parameter value detected', debuginfo: 'context => Invalid parameter value detected: Unexpected keys (0, 1, 2) detected in parameter array.' }
I'm not sure what I should be passing here. Anyone used this before or have any idea of what I should be doing here?
Thanks for your time,
Rob
Re: Rest Web Service - Getting List of System Cohorts
Never mind I worked out that I needed to use system context. Using the following arguments got me all the cohorts in my moodle test site.
args: { query:'', context:{instanceid:10,contextlevel:'system'}, limitnum:100 }
How to get token or login/password of already logged in user?
Hello!
I want to embed to Moodle course Unity WebGL mini-games as quizzes/questions and to exchange data with Moodle such as attempts, correct/wrong answers and so on. To do so I must send requests to Moodle Web Services from Unity code. But how can I get user token or user login/password when he is already logged in?
Thanks in advance.
Re: Why does a category idnumber return null?
Bump.
How can I retrieve category idNumber through WEB API?
Thanks.
Moodle core_user_create_users Access control exception
Can anyone tell me how to use the example code here ?
https://github.com/moodlehq/sample-ws-clients/blob/master/JAVA-REST/RestJsonMoodleClient.java
When I use my admin token from manage token, it always give:
{"exception":"webservice_access_exception","errorcode":"accessexception","message":"Access control exception"}
The tutorials I found did not solve the problem. I currently use moodle cloud.
Thanks in advance
Re: error when adding external functions to a web service.
Hi Rama,
upgrade joomdle plugin,in your plugins tab(using administrator login),then it works.
Thanks
Enroling course and role assignment through rest api
Hi All,
Im using moodle version-3.3 ,iam able to create users through rest API,but i m failing to assign roles and coures to that user presently im facing this error,plz check below.
{"exception":"moodle_exception","errorcode":"wsusercannotassign","message":"You don't have the permission to assign this role (5) to this user (323) in this course(26)."}
Thanks,
Eswar
Can you get the feedback in the grade book with a webservice?
Is it possible to get the feedback that has been given to a student for an assignment with a web service?
We would like to archive not just the grade but also the feedback AND submission in an archive system.
Re: Can you get the feedback in the grade book with a webservice?
Yes, I currently do exactly this for my institution. To get started, have a look at:
https://docs.moodle.org/dev/Web_service_API_functions
And specifically gradereport_user_get_grade_items will be a good start.
Re: Enroling course and role assignment through rest api
You have to muck around with the permissions in the System Admin section of Moodle to get it to work.
(I forget the name of the screen, I think its in "Plugins" or "Webservice" or something like that.
Which web service call allows fetching gradebook categories?
When we invoke gradereport_user_get_grade_items, to get a full list of all student grades in a course, the results include a field named categoryid. But the results do not provide information about the category it refers to. (formulas, etc...) Which web service do we invoke to get this information?
Re: Which web service call allows fetching gradebook categories?
Consider the data extracted from a course with a category
itemtype: course, categoryid: 71, grade: 61.07
itemtype: category, category: 80, grade: 50.87
itemtype: mod, itemname: test 1, grade: 71.6
itemtype: mod, itemname: test 2, grade: 81.00
itemtype: mod, itemname: test 3, grade: 0.00
- What is the name (displayed in the gradebook) for category 80, how do we get it?
- What is the formula for category 80, how do we get it?
The above two questions are not in the data returned by gradereport_user_get_grade_items.
Thanks!