a) Create on second level category hidden with a not hidden sub category. The web service function should not return the hidden category, neither its sub category. Try again with a user having the capability 'moodle/category:viewhiddencategories', the function should return both categories.
b) Create a third level category with a sub category. Set the max category level of your Moodle to 3. The web service function should return the third level category but not its sub category.
c) call the web service function as a user having 'moodle/category:manage' capability, the web service function should return all categories (hidden categories and deep level categories).
Use this client:
https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/client.php
functionname
core_course_get_categories
/// PARAMETERS
$params = array('criteria' => array(array('key' => 'visible', 'value' => '1')), 'addsubcategories' => 0);
'key' => The category column to search, expected keys (value format) are:
"id" (int) the category id,
"name" (string) the category name,
"parent" (int) the parent category id,
"idnumber" (string) category idnumber,
"visible" (int) whether the category is visible or not,
"theme" (string) category theme'),