===== Local Definum: Statistics extraction and Definum services: Technical guide===== ====Access to the service==== The statistics are accessible through a REST URL on the Moodle services API. Token authentication is used and must be set up in the Moodle contacted. The form of the request to use is: https:///webservice/rest/server.php?wstoken=&wsfunction=definum_get_stats&useridfield=&userid= where * **wstoken**: is the access authorisation token set up by the administrator * **useridfield**: is the name of the reference identity field * **userid**: is the value of the identity field, depending on the choice above ====Possible values for "useridfield"==== * **id**: Moodle internal identifier * **username**: Moodle user name * **idnumber**: User identification number (if provisioned) * **email**: For platforms authenticating on email * **oidcuniqid**: the unique OpenID Connect identifier for users provisioned by an OpenID source. * **oidcusername**: The OpenID Connect user name for users provisioned by an OpenID source. ====Data transmitted==== 'id' => new external_value(PARAM_INT, 'userid'), 'lastname' => new external_value(PARAM_TEXT, 'User last name'), 'firstname' => new external_value(PARAM_TEXT, 'User first name'), 'courses' => new external_value(PARAM_INT, 'Number of enrolled courses'), 'finishablecourses' => new external_value(PARAM_INT, 'Courses enrolled having completion enabled'), 'finishedcourses' => new external_value(PARAM_INT, 'Finished courses'), 'finishedcoursesratio' => new external_value(PARAM_INT, 'Finished courses in percent'), 'badges' => new external_multiple_structure( new external_single_sructure([ 'id' => new external_value(PARAM_INT, 'Badge id'), 'name' => new external_value(PARAM_INT, 'Badge name'), 'issuername' => new external_value(PARAM_INT, 'Badge issuer name'), 'issuerurl' => new external_value(PARAM_INT, 'Badge issuer url'), 'issuercontact' => new external_value(PARAM_INT, 'Badge issuer contact'), 'dateissued' => new external_value(PARAM_INT, 'Badge issue date'), 'dateissuedstr' => new external_value(PARAM_INT, 'Badge issue date (readable format)'), ]) ), 'numbadges' => new external_value(PARAM_INT, 'Number of acquired badges'), 'lastlogin' => new external_value(PARAM_INT, 'last login time'), 'lastloginstr' => new external_value(PARAM_TEXT, 'last login time (readable text formatted)'), 'timespentinmonth' => new external_value(PARAM_INT, 'time spent in seconds from the month start (1st of month)'), 'timespentinmonthstr' => new external_value(PARAM_TEXT, 'Time spent (readable text formatted)'), 'loginsinmonth' => new external_value(PARAM_INT, 'Number of connections from the start of month') ----- [[:local:definum|Back to the deffinum plugin index]] - [[:plugins|Back to plugins index]]