Confirm that the entry is approved (you can view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 1)
Now, execute the same WS but adding: approve=0
Confirm that the entry is unapproved (you can't view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 0)
Execute the same curl request but using the student token, confirm you receive an exception: required_capability_exception
Create a course with a database using the image gallery preset . Configure the database so new entries requires approval.
Enrol a couple of users as teacher and student in that course
As the student add a couple of entries to the database.
As teacher approve just one of the entries.
Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
Create a Token in the mobile app service for the teacher and the student in the course:
Click on Site administration ► Plugins ► Web services ► Manage tokens
Next, you can do a CURL REST call simulating a WS client with the teacher token.
You need to replace the wstoken, entryid (with the not yet approved entry id) and the URL of your moodle instance
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'entryid=14&wsfunction=mod_data_approve_entry&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e&moodlewssettingfilter=true' | python -m "json.tool"
Confirm that the entry is approved (you can view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 1)
Now, execute the same WS but adding: approve=0
Confirm that the entry is unapproved (you can't view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 0)
Execute the same curl request but using the student token, confirm you receive an exception: required_capability_exception