Questions tagged [moodle-api]

Moodle has a number of core APIs that provide tools for Moodle scripts.API's are already having functionality that can be reuse,and allow you to interact with Moodle system. They are essential when writing Moodle plugin, or Moodle customization.

Moodle Questions, those are about programming or development in Moodle should use this tag.

there are many core-apis those provide interaction with Moodle core system.

List of API's is

1 Most-used General APIs
    1.1 Access API (access)
    1.2 Data manipulation API (dml)
    1.3 File API (files)
    1.4 Form API (form)
    1.5 Logging API (log)
    1.6 Navigation API (navigation)
    1.7 Page API (page)
    1.8 Output API (output)
    1.9 String API (string)
    1.10 Upgrade API (upgrade)
    1.11 Moodlelib API (core)
2 Other General APIs
    2.1 Admin settings (admin)
    2.2 Availability (availability)
    2.3 Backup API (backup)
    2.4 Cache API (cache)
    2.5 Calendar API (calendar)
    2.6 Comment API (comment)
    2.7 Data definition API (ddl)
    2.8 Enrolment API (enrol)
    2.9 Events API (event)
    2.10 External functions API (external)
    2.11 Lock API (lock)
    2.12 Message API (message)
    2.13 Media API (media)
    2.14 My profile API
    2.15 Preference API (preference)
    2.16 Portfolio API (portfolio)
    2.17 Rating API (rating)
    2.18 RSS API (rss)
    2.19 Tag API (tag)
    2.20 Task API (task)
    2.21 Time API (time)
    2.22 Testing API (test)
    2.23 User-related APIs (user)
    2.24 Web services API (webservice)
3 Activity module APIs
    3.1 Activity completion API (completion)
    3.2 Advanced grading API (grading)
    3.3 Conditional activities API (condition) - deprecated in 2.7
    3.4 Groups API (group)
    3.5 Gradebook API (grade)
    3.6 Plagiarism API (plagiarism)
    3.7 Question API (question)

more about Moodle Api's https://docs.moodle.org/dev/Core_APIs

Most generally used api's are

Form API, File API, Events Api, Logging API, Data manipulation API, Navigation API (navigation) etc.

328 questions
1
vote
1 answer

Moodle Create User API Invalid Parameter Exception

I am trying to register a user via API using Python Request. Here is my code import requests url =…
1
vote
1 answer

Create Category using moodle api call from postman error

I am trying to create a category in moodle making api call from postman API Endpoint: http://localhost/MyMoodle/webservice/rest/server.php Method: POST Payload: Selected…
Bhumi Shah
  • 9,323
  • 7
  • 63
  • 104
1
vote
3 answers

forgot the moodle admin password of my local moodle server

forgot the moodle admin password of my local moodleyour text server i am using the version 4.1 moodle i know the username but unfortunetly forgot the password my local moodle server. i have tried to forgot the password i havent give the smtp address…
1
vote
1 answer

Adding a cronjob with moodle-cron-api is not working properly

I am trying to schedule a task in moodle-cron-api following the instructions here at: https://docs.moodle.org/dev/Task_API. I have the root folder at /local and the name of the root folder is mod_hygene. I have a cut_my_toe_nails.php at…
1
vote
0 answers

Not Getting User roles, Stuck At This

class block_add extends block_base { function init() { $this->title = get_string('pluginname', 'block_add'); } function applicable_formats() { return array('all' => true, 'tag' => false); } function…
1
vote
1 answer

Use function from renderer.php in restore.php

I'm developing a question type plugin for moodle and ran into an issue that you might be able to help me out with. The plugin has the feature that you can attach .pdf files which are opened on a different browser tab via a button. It is realized…
1
vote
1 answer

localhost is currently unable to handle this request. HTTP ERROR 500 while trying to render a custom page from moodle custom plugin

I am very new to moodle. I made a custom plugin for adding some custom feature. I made a custom form using moodle form api. This is the code for custom signup form usign moodleform- `
Shihab
  • 17
  • 6
1
vote
1 answer

About Custom Fields of Moodle

I am using Moodle 3.11. I have a custom course field named discount. how can i fetch names of all the course that provides discount on a new page?
1
vote
1 answer

How to get Moodle user id through Web Services API using token

Some background I am connecting external application (server) with Moodle through Web Services API. First a user obtains web services token through a call to /login/token.php. Above token can be used to call web services functions through…
Anastazy
  • 4,624
  • 2
  • 13
  • 22
1
vote
1 answer

Moodle error: SyntaxError Unexpected token m in JSON at position 0

I've encountered this error in Moodle (v3.11), and was wondering if anyone knows of a fix. I have a block plugin that I am building with my team. All four of us are getting the same error. After installing, when I click on the "Add a Block" button…
Kurt_eh
  • 49
  • 2
  • 10
1
vote
1 answer

How to get a list of all pending assignments under all courses in Moodle using the Web service API

I want to get a list of all assignments along with their completion status under all courses. Basically what is shown under the timeline in the dashboard. The WS function core_course_get_enrolled_courses_by_timeline_classification, gives me all the…
Sujit
  • 1,653
  • 2
  • 9
  • 25
1
vote
1 answer

Perform extra validation after a Student signs into Moodle

I am hoping someone can point me in the right direction. We host a University Moodle site and we are looking for a way in which we can perform extra validation on a Student whenever they login. I will give a scenario. We have an endpoint with a list…
realnsleo
  • 709
  • 2
  • 12
  • 29
1
vote
1 answer

Connecting moodle api through web service

Let me explain: My purpose is to create moodle users from a web app. I am implementing a web app on Tomcat 8.0.15.0. That is, I use java servlets on the server side. Many JSP files and javascript, with much of it in jQuery, resides on the client…
carles
  • 174
  • 1
  • 10
1
vote
1 answer

Global Role with Webservice in Moodle

Is there a web service in Moodle that can be used to assign a global role, e.g. course creator, to a user based on his ID?
user15768887
1
vote
0 answers

How to retrieve Forum/discussion attachments of a course in Moodle LMS?

I have to list all the attachments of a discussion in a course. I don't know how to retrieve all the attachments URLs in a forum/discussion in Moodle LMS. My code is in c# and usually, I call the Moodle REST API as…
Simant
  • 3,142
  • 4
  • 32
  • 61