As admin set the global enablecompletion setting to enabled (in Site administration > Advanced features)
Create one course C1
* C1 with enablecompletion set to 1
Go to the C1 main page, and via the "Cog" open the "Course completion" option and Enable the "Condition: Course grade" using a required course grade of 50
Create two users U1 and U2
Enrol U1 as students in C1
Enrol U2 as teacher in C1
Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
Create a Token in the mobile app service for all the users
Click on Site administration ► Plugins ► Web services ► Manage tokens
Open the console an execute this new curl request, replacing wstoken with the token for U1 and the site url with yours. Replace also the userid to mach U1 one
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_enrol_get_users_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&userid=19' --compressed | python -m "json.tool"
After executing the WS check that:
You receive the course you are enrolled: C1
C1 field completionusesrtracked is set to true
Now, execute the same CURL request but using the U2 token (keeping the original userid) and check that
C1 field completionusesrtracked is set to false