{"id":22621442,"url":"https://github.com/cca/moodle-python-apis","last_synced_at":"2025-03-29T02:24:28.647Z","repository":{"id":48631715,"uuid":"285074019","full_name":"cca/moodle-python-apis","owner":"cca","description":"example scripts to access Moodle web services APIs","archived":false,"fork":false,"pushed_at":"2025-01-09T00:55:22.000Z","size":64,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-03T12:35:17.690Z","etag":null,"topics":["apis","moodle"],"latest_commit_sha":null,"homepage":"https://moodle.cca.edu","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cca.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-04T19:07:26.000Z","updated_at":"2025-01-09T00:55:25.000Z","dependencies_parsed_at":"2025-01-09T01:55:34.348Z","dependency_job_id":"5c58f4fe-1bca-45b1-b6bf-ee098476935a","html_url":"https://github.com/cca/moodle-python-apis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca%2Fmoodle-python-apis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca%2Fmoodle-python-apis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca%2Fmoodle-python-apis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca%2Fmoodle-python-apis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cca","download_url":"https://codeload.github.com/cca/moodle-python-apis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246127751,"owners_count":20727782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apis","moodle"],"created_at":"2024-12-08T23:08:55.662Z","updated_at":"2025-03-29T02:24:28.629Z","avatar_url":"https://github.com/cca.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moodle API Tools\n\nExample scripts for accessing different portions of the Moodle REST APIs. The Moodle APIs are comprehensive but tricky to use. These scripts are illustrative and not intended for production use, though similar code is running in other CCA apps.\n\n## Setup\n\nObtain a [Web Services token](https://moodle.cca.edu/admin/webservice/tokens.php) for a Service with the appropriate API permissions, then save that token in a config.py file (see example.config.py for details) in the root of this project.\n\nThis project uses `uv`. Run `uv sync` to install its dependencies.\n\n## course_get_categories\n\nThis script was an example provided to the Integration Engineer so that a Moodle course database could be built which includes structured enrollment data with knowledge of Moodle course category IDs. This makes it so courses are added under the appropriate categories when they appear in the database. It takes a \"filter\" dict of category properties (e.g. `{\"name\": \"2021SU\"}`) and returns an array of all categories that match the filter and their children.\n\n## course_get_courses_by_field\n\nThis script was an example provided to the Portal team during Learning Hub development so that links to Moodle course sites could be established. The Portal has moved away from having direct access to the Moodle database but Moodle course links require knowledge of Moodle's internal IDs; this script returns course information, including ID, when given a \"shortname\" of form `ANIMA-1000-1-2021FA`.\n\n## course_get_courses\n\nReturns _all_ the Moodle courses using the `core_course_get_courses` wsfunction. This is currently (as of August 2020) the method that the Portal uses to pull Moodle data, which it matches to its course data. So we need to ensure this function works with whatever web services user/token Portal uses.\n\n## enrol_get_enrolled_users\n\nGiven a course ID, returns a list of users enrolled in that course using the `core_enrol_get_enrolled_users` function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcca%2Fmoodle-python-apis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcca%2Fmoodle-python-apis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcca%2Fmoodle-python-apis/lists"}