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

error/moodle/invalidrecord


Re: Why does a category idnumber return null?

How to retrieve module tags through WEB API?

$
0
0
by Peter de Jong.  

How is it possible to retrieve tags applied to a module through the WEB API?


Re: How to retrieve module tags through WEB API?

$
0
0
by Peter de Jong.  

Is there a way to access course summary files through the web API?

Hi everyone

$
0
0
by Akerke Amangazina.  

Hope we can have a good time and try to work really hard

Re: Moodle core_user_create_users Access control exception

$
0
0
by Dorel Manolescu.  

Hi

For the web-service user in moodle did you assign the right permissions to create users:

require_capability('moodle/user:create', $context);
Let us know!

Regards

Re: Problems with webservice access

$
0
0
by Ghislain Nono Gueye.  

Unfortunately, I do not have an answer to your question, but another question. Is it possible to access Moodle's APIs as a teacher and not a site administrator?

Re: Problems with webservice access

$
0
0
by Mayank Tyagi.  

Hi Ghislain,

Yes, it is possible to access Moodle's APIs like Web Services as a teacher. For web services just create a token for the user for which you want to create access capability. you can create a token from Site Administration > Plugins > Webservices > Manage Tokens or hit http://example.com/admin/settings.php?section=webservicetokens.

Regards,

Mayank Tyagi


Re: Problems with webservice access

$
0
0
by Ghislain Nono Gueye.  

Thank you very much for your response. Actually, I am a teacher at a university and after searching for a few days, I was not able to find out how to access Site Administration. My best best is that only the administration of the university has such an access. If that is the case, does that mean that I need to ask them to create a token for me so I can access the APIs?


Sincere thanks.

Re: How to retrieve module tags through WEB API?

Cannot get course list on web services

$
0
0
by Wayne Kruger.  

Hi guys, I am new to moodle and I am trying to retrieve a list of courses via the web service. I followed all the instructions on enabling the web services, creating a user, roles, services, permissions, adding functions, etc.

I am calling:

http://[MOODLE_URL]/webservice/rest/server.php?wstoken=[TOKEN]&moodlewsrestformat=json&wsfunction=core_course_get_courses

But getting back

{"exception": "moodle_exception","errorcode": "errorcoursecontextnotvalid","message": "You cannot execute functions in the course context (course id:2). The context error message was: Course or activity not accessible."}


I am sure it is just some kind of permission or setting somewhere, can any point me in the correct direction?

Much appreciated

Re: Cannot get course list on web services

$
0
0
by Wayne Kruger.  

I changed the function name to core_course_get_courses_by_field and I am getting data back.

In case anyone else has this issue...

Issued with using the REST api

$
0
0
by Aaran Grimley.  

Hi, I have been using the following string to access the REST api of our moodle install


/webservice/rest/server.php/?wsfunction=core_enrol_get_enrolled_users&moodlewsrestformat=json&courseid=5078&wstoken=MYTOKEN&options[0][name]=userfields&options[0][value]=id&options[1][name]=userfields&options[1][value]=fullname&options[2][name]=userfields&options[2][value]=email&options[3][name]=userfields&options[3][value]=username&options[4][name]=userfields&options[4][value]=idnumber


This successfully pumps out some json formatted data like so

[{"id":1600,"username":"name1","fullname":"A Stark","email":"a.stark@email.uk","idnumber":"123456"},{"id":2019,"username":"name2","fullname":"B Stark","email":"b.stark@email.uk","idnumber":"123457"}


 I would also like to get some roles to allow me to better filter the results, I have tried adding 

&options[5][name]=userfield&options[5][value]=roles

To the end of the string but this does not give any additional information. Any advice on how I messed up?

How do we fetch the name of each categoryid returned by gradereport_user_get_grade_items?

$
0
0
by Zadok Lindt.  

The gradereport_user_get_grade_items API call returns a categoryid field, but does not return the "full name" of the category. The name associated with the categoryid is found in the mdl_grade_categories table.

Is there an API call that would allow fetching the "full name" associated with the categories? It appears that there is not. But perhaps I have overlooked it?

See associated JIRA ticket https://tracker.moodle.org/browse/MDL-64399.

Webservice POST error: Invalid token - token not found

$
0
0
by Karishma Tiwari.  

I have enabled the web services, added the service, and added authorised users. With the token, I have the below URL, which I used in Postman to send some create course parameters.


http://xxx/webservice/rest/server.php?wstoken=xxx&moodlewsrestformat=json&wsfunction=core_course_create_courses

However I am getting below error:

{

    "exception": "moodle_exception",

    "errorcode": "invalidtoken",

    "message": "Invalid token - token not found"

}


The token is from the right user (admin), and previously the same test was successful. 

What am i missing here?

Do i need to have a Restful plugin too?


Webservice and core function parameters

$
0
0
by Karishma Tiwari.  

I am running moodle 3.4 on centos, and will be implementing webservices using Rest API for our server.

I have listed out the core functions that we will be using, however we seem to need some additional fields such as Cohort Start/End Date or Employer ID/Employer name.

In the DB I can add these columns to store these data but I am wondering how can I tweak the REST parameters to POST/GET these parameters?

Web Service

$
0
0
by Nirav Vaghasia.  

I have created external web service in moodle 3.6.1 and added one function mod_quiz_start_attempt in external service.

But this service access by only admin when any other user try to access this service they got following error.

{

    "exception": "moodle_quiz_exception",

    "errorcode": "notyourattempt",

    "message": "This is not your attempt!"

}

As a admin if I want to allow other users to attempt the quiz using web service API then is there any possible ways to do this? 

Re: Web Service

$
0
0
by Matteo Scaramuccia.  

Hi Nirav,
you need to authenticate the actual user willing to attend the attempt: you cannot start an attempt as an admin since it will be the attempt of that user.

HTH,
Matteo

startdate FROM mdl_user_enrolments

$
0
0
by Jozef K.  

Hello!

Im trying to get data from table mdl_user_enrolments through web services. What i checked, this web service /core_enrol_get_users_courses/ is getting me pretty much required data, but i am missing some important columns like 'timestart'. I am getting startdate and enddate of course, but i want to get timestart of enrolment. It is possible from different webservice, or it is not? I cant find any usefull web service for this and i dont want to connect to moodle database from external app.

For example what i need:
SQL Query: SELECT timestart FROM mdl_user_enrolments WHERE userid = xy;

Thanks for help, much appreciated.
JK

Moodle 3.6.1 (Build: 20181205)

Re: Webservice and core function parameters

Viewing all 2364 articles
Browse latest View live


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