core_course_get_categories problem

core_course_get_categories problem

by sc vo -
Number of replies: 2

Hello,

maybe you can help me. I am trying to get all categories (core_course_get_categories) over webservice rest api only for users with token, but I get an authentication error. The users/roles have the capability moodle/category:viewhiddencategories.

In Detail:

As I can see there is no core_course_get_categories in built-in services, so I added a new custom service, where I added core_course_get_categories function for all users. Now it should be able to access core_course_get_categories with all users where capability moodle/category:viewhiddencategories is set. But I get an Access control exception L The token for this user works fine with other functions. It works with a self-created “static” token, but I don’t want to have a fixed one.

What can be my problem?

Thank you..

I am using moodle 2.9.1+

Average of ratings: -
In reply to sc vo

Re: core_course_get_categories problem

by Petras Virzintas -

Using 2.9.1 with only REST protocol enabled  I have had no success with core_course_get_categories (see attachment).

I have a single token with only the admin user specified.

Has anyone got this working in 2.9.1 or 2.8.x ?

Rgds
Petras



Attachment cat_xml.jpg
In reply to Petras Virzintas

Re: core_course_get_categories problem

by Petras Virzintas -

FIXED:

I was using the default Moodle:Mobile. Once I created another service and added the function - it worked!


Rgds
Petras