Closed therealsujitk closed 2 years ago
[GET] /login/token.php
?username=
- The username of the user.?password=
- The password of the user.?service=
- The service name as created in the admin panel. (moodle_mobile_app
can be used by default){
"token": "9859148a89546f0efe716a58e340849b",
"privatetoken": "8RpHJevJ42W7QN23OMkeYcdOYw3YfWgWGKsak7WB3Z88wcApSCVZ9TgY6M5fEO1m"
}
[GET] /webservice/rest/server.php
?wstoken=
- The generated token.?moodlewsrestformat=
- The response format. Values: json
& xml
(Default)?wsfunction=
- The function name. core_course_get_enrolled_courses_by_timeline_classification
in this case.?classification=
- (Optional) The time period of the courses. Values: past
, inprogress
& future
{
"courses": [
{
"id": 1137,
"fullname": "Database Management Systems(CSE2004)",
"shortname": "CSE2004_WI20F",
"idnumber": "CSE2004_WI20F",
"summary": "Database Management Systems",
"summaryformat": 1,
"startdate": 1614858420,
"enddate": 1642081620,
"visible": true,
"fullnamedisplay": "Database Management Systems(CSE2004)",
"viewurl": "https://lms.vit.ac.in/course/view.php?id=1137",
"courseimage": "data:image/svg+xml;base64,...",
"progress": 3,
"hasprogress": true,
"isfavourite": false,
"hidden": false,
"showshortname": false,
"coursecategory": "SCOPE"
}
],
"nextoffset": 27
}
[GET] /webservice/rest/server.php
?wstoken=
- The generated token.?moodlewsrestformat=
- The response format. Values: json
& xml
(Default)?wsfunction=
- The function name. mod_assign_get_assignments
in this case.?courseids[]=
- (Optional) An array of course ids. Ex: ?courseids[0]=1137&courseids[1]=1419
?capabilities[]
- (Optional) An array of capabilities. Ex: ?capabilities[0]=mod/assign:view&capabilities[1]=mod/assign:submit
{
"courses": [
{
"id": 1137,
"fullname": "Database Management Systems(CSE2004)",
"shortname": "CSE2004_WI20F",
"timemodified": 1614772066,
"assignments": [
{
"id": 10922,
"cmid": 23258,
"course": 1137,
"name": "Digital Assignment1",
"nosubmissions": 0,
"submissiondrafts": 1,
"sendnotifications": 0,
"sendlatenotifications": 0,
"sendstudentnotifications": 1,
"duedate": 1618939800,
"allowsubmissionsfromdate": 1616524200,
"grade": 100,
"timemodified": 1618632150,
"completionsubmit": 1,
"cutoffdate": 0,
"gradingduedate": 0,
"teamsubmission": 0,
"requireallteammemberssubmit": 0,
"teamsubmissiongroupingid": 0,
"blindmarking": 0,
"hidegrader": 0,
"revealidentities": 0,
"attemptreopenmethod": "none",
"maxattempts": -1,
"markingworkflow": 0,
"markingallocation": 0,
"requiresubmissionstatement": 1,
"preventsubmissionnotingroup": 0,
"submissionstatement": "This submission is my own work, except where I have acknowledged the use of the works of other people.",
"submissionstatementformat": 1,
"configs": [
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "enabled",
"value": "1"
},
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "maxfilesubmissions",
"value": "20"
},
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "maxsubmissionsizebytes",
"value": "41943040"
},
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "filetypeslist",
"value": ""
},
{
"plugin": "comments",
"subtype": "assignsubmission",
"name": "enabled",
"value": "1"
},
{
"plugin": "comments",
"subtype": "assignfeedback",
"name": "enabled",
"value": "1"
},
{
"plugin": "comments",
"subtype": "assignfeedback",
"name": "commentinline",
"value": "0"
},
{
"plugin": "editpdf",
"subtype": "assignfeedback",
"name": "enabled",
"value": "1"
}
],
"intro": "",
"introformat": 1,
"introfiles": [],
"introattachments": [
{
"filename": "Assignment 1 - ER DIAGRAM EXERCISES _ Dr.Sivabala Krishnan.doc",
"filepath": "/",
"filesize": 102400,
"fileurl": "https://lms.vit.ac.in/webservice/pluginfile.php/133798/mod_assign/introattachment/0/Assignment%201%20-%20ER%20DIAGRAM%20EXERCISES%20_%20Dr.Sivabala%20Krishnan.doc",
"timemodified": 1616566904,
"mimetype": "application/msword",
"isexternalfile": false
}
]
}
]
},
{
"id": 1419,
"fullname": "Software Engineering(CSE3001)",
"shortname": "CSE3001_F21",
"timemodified": 1630210709,
"assignments": [
{
"id": 16888,
"cmid": 33887,
"course": 1419,
"name": "EX1_SRS_L27_28_PMS",
"nosubmissions": 0,
"submissiondrafts": 1,
"sendnotifications": 0,
"sendlatenotifications": 0,
"sendstudentnotifications": 1,
"duedate": 1630593000,
"allowsubmissionsfromdate": 1630135800,
"grade": 100,
"timemodified": 1630139363,
"completionsubmit": 1,
"cutoffdate": 0,
"gradingduedate": 0,
"teamsubmission": 0,
"requireallteammemberssubmit": 0,
"teamsubmissiongroupingid": 0,
"blindmarking": 0,
"hidegrader": 0,
"revealidentities": 0,
"attemptreopenmethod": "none",
"maxattempts": -1,
"markingworkflow": 0,
"markingallocation": 0,
"requiresubmissionstatement": 1,
"preventsubmissionnotingroup": 0,
"submissionstatement": "This submission is my own work, except where I have acknowledged the use of the works of other people.",
"submissionstatementformat": 1,
"configs": [
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "enabled",
"value": "1"
},
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "maxfilesubmissions",
"value": "2"
},
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "maxsubmissionsizebytes",
"value": "41943040"
},
{
"plugin": "file",
"subtype": "assignsubmission",
"name": "filetypeslist",
"value": ""
},
{
"plugin": "comments",
"subtype": "assignsubmission",
"name": "enabled",
"value": "1"
},
{
"plugin": "comments",
"subtype": "assignfeedback",
"name": "enabled",
"value": "1"
},
{
"plugin": "comments",
"subtype": "assignfeedback",
"name": "commentinline",
"value": "0"
},
{
"plugin": "editpdf",
"subtype": "assignfeedback",
"name": "enabled",
"value": "1"
}
],
"intro": "<p dir=\"ltr\"><span style=\"font-size: 0.9375rem;\">Write Software Requirements Specification document (SRS) for Passport Management System (PMS). </span><br></p><p dir=\"ltr\">(Note: you’re free to make further assumptions in the scenario if required.)</p>",
"introformat": 1,
"introfiles": [],
"introattachments": [
{
"filename": "SRS_template-IEEE.doc",
"filepath": "/",
"filesize": 59904,
"fileurl": "https://lms.vit.ac.in/webservice/pluginfile.php/147605/mod_assign/introattachment/0/SRS_template-IEEE.doc",
"timemodified": 1630139307,
"mimetype": "application/msword",
"isexternalfile": false
}
]
}
]
}
],
"warnings": [
{
"item": "module",
"itemid": 21754,
"warningcode": "1",
"message": "No access rights in module context"
}
]
}
[GET] /webservice/rest/server.php
?wstoken=
- The generated token.?moodlewsrestformat=
- The response format. Values: json
& xml
(Default)?wsfunction=
- The function name. core_webservice_get_site_info
in this case.{
"sitename": "Moodle Site",
"username": "username",
"firstname": "John",
"lastname": "Doe",
"fullname": "John Doe",
"lang": "en",
"userid": 12345,
"siteurl": "https://example.moodle.com",
"userpictureurl": "https://secure.gravatar.com/avatar/36441ac19a2ea2cad8382cc8029f64b3?s=100&d=mm",
"functions": [
{
"name": "core_badges_get_user_badges",
"version": "2020061500.01"
},
{
"name": "core_blog_get_entries",
"version": "2020061500.01"
}
],
"downloadfiles": 1,
"uploadfiles": 1,
"release": "3.9+ (Build: 20200618)",
"version": "2020061500.01",
"mobilecssurl": "",
"advancedfeatures": [
{
"name": "usecomments",
"value": 1
},
{
"name": "usetags",
"value": 1
},
{
"name": "enablenotes",
"value": 1
},
{
"name": "messaging",
"value": 1
},
{
"name": "enableblogs",
"value": 1
},
{
"name": "enablecompletion",
"value": 1
},
{
"name": "enablebadges",
"value": 1
},
{
"name": "messagingallusers",
"value": 0
},
{
"name": "mnet_dispatcher_mode",
"value": 0
}
],
"usercanmanageownfiles": true,
"userquota": 100,
"usermaxuploadfilesize": 41943040,
"userhomepage": 1,
"userprivateaccesskey": "aecb4601196985077a20ec221a042b69",
"siteid": 1,
"sitecalendartype": "gregorian",
"usercalendartype": "gregorian",
"userissiteadmin": false,
"theme": "boost"
}
[GET] /webservice/rest/server.php
?wstoken=
- The generated token.?moodlewsrestformat=
- The response format. Values: json
& xml
(Default)?wsfunction=
- The function name. core_completion_get_activities_completion_status
in this case.?userid=
- The student user id.?courseid=
- The course id of the activities.{
"statuses": [
{
"cmid": 32682,
"modname": "resource",
"instance": 7665,
"state": 0,
"timecompleted": 0,
"tracking": 1,
"overrideby": null,
"valueused": false
},
{
"cmid": 36709,
"modname": "assign",
"instance": 8519,
"state": 1,
"timecompleted": 1637841666,
"tracking": 1,
"overrideby": null,
"valueused": false
}
],
"warnings": []
}
[GET] /webservice/rest/server.php
?wstoken=
- The generated token.?moodlewsrestformat=
- The response format. Values: json
& xml
(Default)?wsfunction=
- The function name. mod_assign_get_submission_status
in this case.?assignid=
- The assignment id.{
"lastattempt": {
"submission": {
"id": 128,
"userid": 56,
"attemptnumber": 0,
"timecreated": 1643884542,
"timemodified": 1643884542,
"status": "new",
"groupid": 0,
"assignment": 119,
"latest": 1,
"plugins": [
{
"type": "onlinetext",
"name": "Online text",
"fileareas": [
{
"area": "submissions_onlinetext",
"files": []
}
],
"editorfields": [
{
"name": "onlinetext",
"description": "Online text submissions",
"text": "",
"format": 1
}
]
},
{
"type": "file",
"name": "File submissions",
"fileareas": [
{
"area": "submission_files",
"files": []
}
]
},
{
"type": "comments",
"name": "Submission comments"
}
]
},
"submissiongroupmemberswhoneedtosubmit": [],
"submissionsenabled": true,
"locked": false,
"graded": false,
"canedit": true,
"caneditowner": true,
"cansubmit": false,
"extensionduedate": null,
"blindmarking": false,
"gradingstatus": "notgraded",
"usergroups": [
44
]
},
"warnings": []
}
[POST] /webservice/upload.php
?token=
- The generated token.?itemid=
- The file area item id. Use 0
to generate a new item id./
.file
, file1
, etc.[
{
"component": "user",
"contextid": 411,
"userid": "56",
"filearea": "draft",
"filename": "file1.txt",
"filepath": "/",
"itemid": 419959062,
"license": "allrightsreserved",
"author": "Barbara Gardner",
"source": "O:8:\"stdClass\":1:{s:6:\"source\";s:10:\"file1.txt\";}"
},
{
"component": "user",
"contextid": 411,
"userid": "56",
"filearea": "draft",
"filename": "file2.txt",
"filepath": "/",
"itemid": 419959062,
"license": "allrightsreserved",
"author": "Barbara Gardner",
"source": "O:8:\"stdClass\":1:{s:6:\"source\";s:8:\"file2.txt\";}"
}
]
[POST] /webservice/rest/server.php
⚠️ Warning: This function removes previous uploads to an assignment. The only current work around is to download the previous attempt, and upload them to the draft area before uploading the new files.
?wstoken=
- The generated token.?moodlewsrestformat=
- The response format. Values: json
& xml
(Default)?wsfunction=
- The function name. mod_assign_save_submission
in this case.?assignmentid=
- The assignment id.?plugindata[files_filemanager]=
- The file area item id.[]
[POST] /webservice/rest/server.php
?wstoken=
- The generated token.?moodlewsrestformat=
- The response format. Values: json
& xml
(Default)?wsfunction=
- The function name. mod_assign_submit_for_grading
in this case.?assignmentid=
- The assignment id.?acceptsubmissionstatement=
- If the user has acknowledged the work belongs to him/her. Values: 0
& 1
[]
The
AssignmentsFragment.java
class needs to display the assignments from https://lms.vit.ac.in (A Moodle platform).Web Services API: https://docs.moodle.org/dev/Web_service_API_functions