Creating subcategories with webservice

Creating subcategories with webservice

by Hakan ERSU -
Number of replies: 0

Hi i am using moodle 1.9+ and i have some scripts that i can insert categories and courses to mysql manually.

Recently i started to look moodle 2.5.I can insert top level categories with rest core_course_create_courses but i cant figure how to insert subcategories.

I have simple array that have id's and sub id's;

Array
(
[0] => Array
(
[id] => 4399
[name] => Category Name 4399
[parent] => 18
[path] => /18/4399
[depth] => 2
)

[1] => Array
(
[id] => 60799
[name] => Category Name 60799
[parent] => 18
[path] => /18/60799
[depth] => 2
)

[2] => Array
(
[id] => 4299
[name] => Category Name 4299
[parent] => 18
[path] => /18/4299
[depth] => 2
)

[3] => Array
(
[id] => 52199
[name] => Category Name 52199
[parent] => 18
[path] => /18/52199
[depth] => 2
)
[4] => Array
(
[id] => 18
[name] => Category Name 18
[parent] => 0
[path] => /18
[depth] => 1
)
)
Any idea that i can insert subcategories with webservices.

My old way (manually to mysql with script ) works well when i insert categories but i cant insert courses because of context errors.

Average of ratings: -