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

Re: How to retrieve the User Enrolment ID

$
0
0
by Mayank Tyagi.  

Hello,

No, the core_enrol_edit_user_enrolment is not for change user role in the enrolled course.
For assigning the role to a user you can use core_role_assign_roles.
What do you mean by changing the user role? Is it mean to unassign the current role of the user in that course and assign the new role?
Well as far in my knowledge there is no direct web service for this(unassign present role and assign new). You can do it in two steps:-
1) use core_role_unassign_roles to unassign current role.
2) use core_role_assign_roles to assign new role.
If you don't want to use these web service you can make your own web service for this functionality.

Regards
Mayank

Re: Get roles Webservice API

$
0
0
by Andreas Grabs.  

Hi Venel,

in my opinion there is no such webservice. What do you want to achieve? Maybe there is another way to do that.

Best regards
Andreas

Re: Get roles Webservice API

$
0
0
by Venel Romain.  

I work with some schools that own a Moodle. I can retrieve school users and integrate them directly into my platform through a middleware. I also need the roles of the users but the Moodle api does not allow to get roles.

I don’t know if there’s any other way to do that.

Thanks again for your time.

Re: Get roles Webservice API

$
0
0
by Andreas Grabs.  

Hi Venel,

I am sorry, but you still keep saying the same things like in the german forum. As I said, there is no webservice to get the roles of a user. But if you'd tell us what do you want to do, maybe there is an alternative way to achieve your goal.

If you want to get all users from course for example you maybe can use the webservice function: "core_enrol_get_enrolled_users_with_capability". By naming the capability you could differ between students and teachers.

The problem with roles is that they can be changed without to inform the external system. Capabilities for example always are the same.

Best regards
Andreas

Using swagger-php for Moodle web services

$
0
0
by Mohammad Hallak.  

I want to be able to generate documentation for Moodle web services by using swagger-php. I couldn’t find any detailed guide or examples, I just read what I could find on github but nothing is working for me so far.

This is what I’ve done at the moment:

  1. I've downloaded and installed swagger editor following the steps and documentation mentioned in github : https://github.com/swagger-api/swagger-editor

  2. I've installed swagger-php from github as well following the steps mentioned:https://github.com/zircote/swagger-php

  3. I've installed composer as requested in http://zircote.com/swagger-php/Getting-started.html#installation

  4. Tried reading http://zircote.com/swagger-php/Getting-started.htm but couldn't make a step forward.

I'll be happy to provide more information if needed.

Re: Angular Application

$
0
0
by noha drweesh.  

Have you got a solution as I'm trying to integrate angular too

What is "marker" in course info?

$
0
0
by Thomas Nelson.  

A course (from core_course_get_courses_by_field for example) has for one of its fields 

marker int  Optional//Current course marker
What is this "marker"?  I can't find any obviously related setting in course settings.  Many of my courses have 0 for this, but some don't, and I'm not sure why or what it means.  I haven't found any docs about it.  What is this thing?

Unable to update feedback using wsfunction=core_grades_update_grades with str_feedback

$
0
0
by Ali Raza.  

I am trying to submit a grade for a student using the core_grades_update_grades function. The correct grade value for the course, module and student is posted successfully. However, the feedback string doesn't show. Here is the URL I have used:


https://abc.com/webservice/rest/server.php?wstoken=[token]&wsfunction=core_grades_update_grades&moodlewsrestformat=json&source=ap&courseid=19&component=mod_url&activityid=817&itemnumber=0&itemdetails[itemname]=Activity&itemdetails[idnumber]=0&grades[0][studentid]=19&grades[0][grade]=79&grades[0][str_feedback]= well+done+mate

Can you help with this please?

Web Services: enrol_manual_enrol_users => Access control exception

$
0
0
by Nicolas JOURDAIN.  

Hi there,

I am writing a PHP script to create Moodle users and enrol them into courses if required. (Moodle 3.5)

My script is successfully calling these Moodle web services:

  • core_user_get_users_by_field
  • core_user_create_users
  • core_enrol_get_enrolled_users

However when using the 'enrol_manual_enrol_users' web service function I get this error:

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://[MY_WEBSITE]/webservice/restful/server.php/enrol_manual_enrol_users` resulted in a `400 Bad Request` response:
{"exception":"webservice_access_exception","errorcode":"accessexception","message":"Access control exception"}


I did the following checking:

  • The web service 'enrol_manual_enrol_users' is correctly added to the external services I created.Web Services - External Services - Functions

NOTICE: to make API calls to Moodle I make use of the Restful Plugin provided by Catalyst (https://moodle.org/plugins/webservice_restful


QUESTIONS:

Any idea on how to fix this issue? Is a permission/capability missing?


Thanks for your help.


SSO login script from external site

$
0
0
by Karishma Tiwari.  

I am using Moodle 3.4.

I have setup the SSO webservice that is able to authenticate moodle user & password, and returns the token as below:

{
    "token": "f82e4a6173109a17e0a19b8e7a5c6945",
    "privatetoken": null
}
How / where do I use this token from the external site to allow SSO login for my moodle users?


I have the html format here but I dont see where to pass this token to create the logged in session:

<form id="login" class="expose" method="post" action="http://aicbuat-elearning.aicb.org.my/login/index.php">

<input type="hidden" name="username" id="username" size="20" value="<?php echo $username ?>" />

<input type="hidden" type="password" name="password" id="password" size="20" value="<?php echo $password ?>" />

</form>




gradereport_overview_get_course_grades not return grademax

$
0
0
by Daniel Miranda.  

I'm using gradereport_overview_get_course_grades function to get students graderaw in a course.
I got this as a result and that is fine:
{
"grades":[
{
"courseid":13,
"grade":"-",
"rawgrade":null
},
{
"courseid":10,
"grade":"26,00",
"rawgrade":"26.00000"
}
],
"warnings":[]
}

The problem is that I need to know the grademax for each course.
Previously I was using core_grades_get_grades to get all I needed but since this is a deprecated function I'm changing this.

Is this a missing parameter in this function or is there another way to get the grademax for each course a student is enrolled?

Webservice problem

$
0
0
by Ali Ahmadian.  

Hello

A website gave me a web services that i could send users quiz grades to that site from moodle.That site has changed the URL from http to https and now i cant send grades.I changed the http to https in given web service data but when the web service  runs  it shows 503 error.

My moodle site is running on http.

Thnaks

Not able to connect through Moodle app

$
0
0
by S K Mathew.  

Using Moodle 3.7 and hosting on AWS EC2

I enabled Administration> Advanced features > Web services

Enabled Administration -> Plugins -> Web Services -> External Services -> Enable mobile web service

As I am trying to make the Mobile App connection I am getting this error Error connecting to the server.

Let me know what I should do.

Thanks

Shibu

Re: Not able to connect through Moodle app

$
0
0
by David Delcò.  

Hi Shibu,
In the meantime, have you solved it? I am experiencing the same problem (my site have the HTTPS protocol as requested)
Thank you.
David

Re: Not able to connect through Moodle app


core_message_get_messages returns me more unread notifications than shown in the notification panel

$
0
0
by Jeff Noel.  

I'm calling core_message_get_messages with the parameters useridto={userid} and read=0, but even though the user doesn't see any new notifications when logged on Moodle, the web service returns me unread notifications. Some people have hundreds of unread notifications, but Moodle's UI doesn't show them.

Why is the web service returning so much data ? We used it on our organization's website and people are confused because they see notifications that aren't shown when they are on Moodle (most of them are really old notifications).

Can anyone enlighten me?

Thanks in advance for your help guys.

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

$
0
0
by Giannis Theodoulou.  

Same error here, fresh installation, all plugins working and up to date

Any ideas?

404 Not Found when trying to call REST api

$
0
0
by Giannis Theodoulou.  

Hello, 

i made a custom web service and i am trying to call the api: https://lms.nup.ac.cy/NUP/REST/api/Enrollment/g.theodoulou/2 which gives me an error 404 not found.

We were using Windows Server with IIS when this was working fine, now we have a fresh installation using Ubuntu, is there something i am missing? Does Apache needs some configuration to allow ASP.NET applications?

Webservice api: How does a 'query' in 'core_cohort_search_cohorts' has to look like?

$
0
0
by Moritz Neuhaus.  

Hi,

For our project I have to get the id's of specific cohorts, so I can add members to them. Looks like I can do that with the API function 'core_cohort_search_cohorts'.

It has the argument "query'. But I can't find any documentation about the syntax of such a querystring. I succeeded getting a lists of cohorts with this function with an empty query. Now I want to search a specific cohort by name.

I was guessing something like "query"=>"name='myCohort'". But that returns an empty array.

Does anybody know the right answer?

Thanks in advance,

Moritz

Re: core_message_get_messages returns me more unread notifications than shown in the notification panel

$
0
0
by Jeff Noel.  

Code 18.

Please remove or close this thread.
Viewing all 2365 articles
Browse latest View live


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