Re: Getting a web service token with SSO
Web Service From Postman Not Working
Hello To All,
I have created a web service by following all the method given in documentation and i have generated the token as well.
Now, i am trying to test the core_course_get_courses using postman.
The response is html which says me you are not logged in.
If anyone knows to fix it then please help!
Thank you !
Re: How do we fetch the name of each categoryid returned by gradereport_user_get_grade_items?
Hi Zadok
Have you possibly found anything around this as yet? I see something different in the index.php with regards to rendering, but i don't actually know which php files would need changing and it's not good to change core code, but i am just testing so it would be nice to know. I am also looking for the itemname for each category in the gradebook... I am following you on MDL_tracker also..
Thank you
Regards
Re: Getting a web service token with SSO
Hi Dorel
Thanks for responding. I've had a look at the plugin but it seems to be for logging in to Moodle not for getting a token.
I'm happy for the user to have to log in to Moodle the normal way, I just need to be able to get a token so they can use the web services in the context of their user
Thanks
Gordon
Re: Getting a web service token with SSO
I understand. In that case you may want to have a look on how the moodle app is doing that. Seems to me you want a similar behaviour. Based on my understanding a token is generated every time a user is connecting to the app and that token is used to manage user activity on the app.
Regards
Re: Web Service From Postman Not Working
I suppose you created a user and for that user you created a token. Now the question is : does user user have the permission to : core_course_get_courses?
Regards
Re: How do we fetch the name of each categoryid returned by gradereport_user_get_grade_items?
{"id":23,"itemname":"","itemtype":"category","itemmodule":null,"iteminstance":12,"itemnumber":null,"categoryid":null,"outcomeid":null,"scaleid":null,"locked":false,"weightraw":0.5,"weightformatted":"50.00 %","graderaw":0,"gradedatesubmitted":null,"gradedategraded":1570604344,"gradehiddenbydate":false,"gradeneedsupdate":false,"gradeishidden":true,"gradeislocked":false,"gradeisoverridden":false,"gradeformatted":"0.00","feedback":"","feedbackformat":0},
Re: Missing functions at Web Service Test Client
I have same question. Did you find any solution?
Thanks in advance.
Missing capabilities:Web services
I enable the web services and I added a token the User is my account that is an admin, and I get
Missing capabilities: moodle/badges:viewotherbadges, moodle/calendar:manageentries, moodle/calendar:manageownentries, moodle/calendar:managegroupentries, moodle/comment:view, moodle/competency:competencyview, moodle/competency:evidencedelete, moodle/competency:competencymanage, moodle/competency:competencygrade, moodle/competency:coursecompetencyview, moodle/competency:usercompetencyview, report/completion:view, moodle/category:viewhiddencategories, moodle/course:update, moodle/course:viewhiddencourses, moodle/course:view, moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups, moodle/course:viewparticipants, moodle/course:managegroups, moodle/site:deleteownmessage, moodle/user:editownmessageprofile, moodle/site:sendmessage, moodle/notes:manage, moodle/notes:view, moodle/question:flag, moodle/rating:rate, moodle/rating:view, moodle/user:manageownfiles, moodle/user:editownprofile, moodle/user:editprofile, moodle/user:editmessageprofile, gradereport/overview:view, gradereport/user:view, message/airnotifier:managedevice, mod/assign:view, mod/assign:viewgrades, mod/assign:grade, mod/book:read, mod/chat:chat, mod/choice:choose, mod/data:writeentry, mod/data:approve, mod/data:manageentries, mod/data:viewentry, mod/feedback:viewanalysepage, mod/feedback:view, mod/feedback:viewreports, mod/feedback:complete, mod/folder:view, mod/forum:startdiscussion, mod/forum:replypost, mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting, mod/glossary:write, mod/glossary:view, mod/glossary:approve, mod/imscp:view, mod/label:view, mod/lesson:view, mod/lesson:viewreports, mod/lti:view, mod/page:view, mod/quiz:view, mod/quiz:attempt, mod/quiz:reviewmyattempts, mod/resource:view, mod/scorm:savetrack, mod/survey:participate, mod/url:view, mod/wiki:editpage, mod/wiki:viewpage, mod/workshop:submit, mod/workshop:view, moodle/competency:planview, moodle/competency:planviewown, moodle/competency:userevidenceview |
Can someone tell me from where I can't add the capabilities.
Thank you
Mark course completed with WS API call
Hello everyone,
I am working on a mobile app that communicates with Moodle via Web Service API. App downloads the Moodle course scorm package and presents it in a web view for users to interact with.
Once the user finishes the course, however, the completion status for that particular user is not saved to the Moodle DB. I've tried using the following ws functions to force marking the course as "completed":
- mod_scorm_insert_scorm_tracks
- core_completion_mark_course_self_completed
- core_completion_override_activity_completion_status
- core_completion_update_activity_completion_status_manually
neither of them did what I wanted (I am checking the course completion with core_completion_get_course_completion_status, I hope that is correct).
So now I am wondering - is there actually a way to mark the course as completed for a specific user via WS API? And if there is, what ws function should I call to achieve this?
Thanks in advance for any response and help.
Cant show image of course since own ws
I am developing webservices under the Laravel framework for use in developing apps in ionic. All the tables I use are from Laravel, my login service comes to work but when I finish the courses and their images, the latter does not appear and does not show me as an error. If I inspect and get the url, when placed in my browser, it asks me to log in and after that the image appears. How can I see the images of the courses in my app since I am literally logged in?
I attach catches
Update an assignment using web services API
I am trying to get contents of an assignment, change it and upload it again on the server using web services API.
I got the assignment content using:
"https://mymoodlesite.com/webservice/rest/server.php?wsfunction=mod_assign_get_assignments&wstoken=token&moodlewsrestformat=json"
and edited the contents(to be specific 'intro' field of the assignment).
I need help in uploading my changes to the server. Couldn't find any web-services function for this. Seems like only way is either defining a manual web services function or accessing the database somehow and edit the entry there. Both seem to be very complicated. Any help will be appreciated.
Protocolo XML-RPC: core_course_create_categories
Exception: Excepción al control de acceso | DEBUG INFO: Access to the function core_course_create_categories() is not allowed.
There could be multiple reasons for this:
1. The service linked to the user token does not contain the function.
2. The service is user-restricted and the user is not listed.
3. The service is IP-restricted and the user IP is not listed.
4. The service is time-restricted and the time has expired.
5. The token is time-restricted and the time has expired.
6. The service requires a specific capability which the user does not have.
7. The function is called with username/password (no user token is sent)
and none of the services has the function to allow the user.
These settings can be found in Administration > Site administration
> Plugins > Web services > External services and Manage tokens. | ERRORCODE: accessexception in /home4/g/public_html/moodle/webservice/xmlrpc/lib.php:94
How to get courses in a category and any subcategories with courses
Using curl and jq, I can fetch course id and fullname from a category, like this:
curl "https://domain/webservice/rest/server.php?wstoken=token_string_here&wsfunction=core_course_get_courses_by_field&moodlewsrestformat=json&field="category"&value="category_id_here"" | jq -r '.courses[] | "\(.id) \(.fullname)"'
However, I would to include any subcategories below the chosen category_id and get those courses as well, i.e.
-- (starting category) -- any courses in starting category + subcategory1 with its courses + subcategory2 with its courses etc.
Is this possible directly with the APIs in Moodle 3.5.x by changing the command line above?
Re: Missing capabilities:Web services
What are you trying to do?
Which web-service are you trying to access: the moodle mobile app collection or a custom one or just a particular ws?
By the way is never a good idea to give admin permissions to a web-service user.
Regards
Re: Moodle API Single-Sign-On (SSO)
Re: Web Service From Postman Not Working
I'm not the OP, sorry, but in my case, I'm even using a token I created for the admin user just for testing. I've checked the user permissions (allowed to do everything) and I'm still receiving an Access Control Exception error.
Re: How to retrieve the User Enrolment ID
Hi Mayank,
Core_enrol_get_enrooled_users
This method DOES NOT return the user enrolment id.
I use core_enrol_get_users_courses to get a list of courses user A is in. Then I display all course on the view.
* Course A Update
* Course B Update
* Course C Update
I click the "Update" button next to course A. How can I update my enrolment if I don't have the enrolment ID?
Kind regards,
Aaron
Are Webservice APIs sessionless?
While going through the Webservice API documentation, can see that some of these APIs need authentication which can be done either by token or username/password.
Want to know if these APIs create any session? Can see MoodleSession as one of the cookies. But don't see these cookies ever been used in webservice APIs example ( mod_scorm_get_scorm_attempt_count, mod_scorm_insert_scorm_tracks).
Should these APIs be considered as sessionless APIs?
Re: core_grades_update_grades syntax
Hello Dan Nice to meet you, I am writing from Guatemala. Sorry, I ran into your forum "core_grades_update_grades syntax" on moodle.org Did you manage to work with this function? If so, can you give me an example of how to consume it? I look forward to your comments and very grateful in advance.
Best regards,
Sincerely,
Arodi Emmanuel