by Fehmi M'Barek.
Ahhhh now I understand,
you don't need to authenticate. Because this is an authorization request. You need to create an authorization Token for that particular user that you have created.
you don't need to authenticate. Because this is an authorization request. You need to create an authorization Token for that particular user that you have created.
You have to go to "> Site administration > Plugins Web services > Manage tokens"
After that you fire out a request without authentication. Thats how so called OAuth2 authorization Tokens work.
curl -X POST \
'https://mymoodle.tld/webservice/rest/server.php?wstoken=XXXXXXXXXXXX&wsfunction=core_course_create_courses&moodlewsrestformat=json&courses[0][fullname]=MyCourse&courses[0][shortname]=ShortName&courses[0][categoryid]=14&courses[0][format]=&courses[0][visible]=&courses[0][groupmode]='
curl -X POST \
'https://mymoodle.tld/webservice/rest/server.php?wstoken=XXXXXXXXXXXX&wsfunction=core_course_create_courses&moodlewsrestformat=json&courses[0][fullname]=MyCourse&courses[0][shortname]=ShortName&courses[0][categoryid]=14&courses[0][format]=&courses[0][visible]=&courses[0][groupmode]='
Hope that helps you.
Best regards
Fehmi