Table des matières

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://<moodlewwwroot>/webservice/rest/server.php?wstoken=<token>&wsfunction=definum_get_stats&useridfield=<useridfield>&userid=<userid>

where

Possible values for "useridfield"

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')


Back to the deffinum plugin index - Back to plugins index