by don mega.
at first you need to create a token for access API
use command curl for example or Postman, etc
curl -d username="student" -d password="sandbox" "https://sandbox.moodledemo.net/login/token.php?service=moodle_mobile_app"
i use VSC extension "rest client":
###
?wstoken=695648fd6a1a06308823fa6dd9f338c8
&courseid=2
&moodlewsrestformat=json
&wsfunction=core_course_get_contents