Submit a ticket My Tickets
Welcome
Login

NexSIS API

TABLE OF CONTENTS


NexSIS API Introduction

MoodleUS NexSIS API is a RESTful API that facilitates realtime integrations between Moodle and 3rd party systems, especially management information systems such as student information systems (SIS), human resources information systems (HRIS), and customer relationship management systems (CRM).


Why not Moodle core external services?

It is true that Moodle comes with external services available out of the box. These work well for their specific purpose; however, we have found that they are neither well geared towards nor designed for integration with a management information system. For example, they do not facilitate bulk operations, and they operate on the unique identifiers of the Moodle system.

MoodleUS has designed the NexSIS API from the ground up. Some of the key differences with Moodle's built-in external services are:

  • Simpler, more streamlined API calls geared towards a management information system

  • Facilitation of both individual and bulk operations

  • Operations performed on the unique identifiers of the external system


Requests

Authentication

Header authentication example:

GET /enrol/nexsis/api/index.php/ping HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*


Query parameter example:

GET /enrol/nexsis/api/index.php/ping?token={token} HTTP/1.1

       Host: example.moodle.com

       Accept: */*

      

NexSIS uses API keys to allow access to the API. You can enable the API and generate an API Key in the plugin's Moodle administration area.


NexSIS expects for the API key to be included in all API requests to the service. You have the option of passing the key in an Authorization header or as a query parameter named token.


The authorization header must follow the following format, where {token} is your API key:

Authorization: Bearer {token}


You must replace {token} with your API key.


HTTP Verbs

NexSIS API is a RESTful API and operates using the standard HTTP verbs. A brief description of each follows:


Verb

Description

GET

retrieve a resource

POST

create a new resource

PUT

update a resource

DELETE

delete or remove a resource



NexSIS considers the management information system to be the master record of some resources. Therefore, those resources do not support the POST verb. Since the resources already exist and have a unique identifier, and Moodle just has a copy of the resource, both Moodle creation and update use the PUT verb.


Sending Data

Example request (JSON):

PUT /enrol/nexsis/api/index.php/enpoint HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json


       {

         "param1": "value1",

         "param2": "value2",

       }

      

Example request (URL-encoded):

PUT /enrol/nexsis/api/index.php/enpoint HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/x-www-form-urlencoded


       param1=value1&param2=value2

      

When sending data to the API, you can choose whether to send data in JSON or in URL-encoded format.


When sending JSON data, be sure to set the Content-Type header to application/json.


Responses

Unless otherwise noted or specified, all responses from the NexSIS API are JSON encoded format.


Health Checks

Ping

Endpoint:

GET /enrol/nexsis/api/index.php/ping

      

Example request:

GET /enrol/nexsis/api/index.php/ping HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      


Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "message": "pong"

       }

      

This endpoint can be used to ping the API in order to determine its operational status.


Courses

Get a Course

Endpoint:

GET /enrol/nexsis/api/index.php/course/{courseid}

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "courseid": "C789",

         "fullname": "Principles of API Design",

         "shortname": "TECH-231"

         "startdate": "2017-08-16T21:09:30+00:00",

         "categorypath": "/Technology/Design/Modern Programming"

       }

      

This endpoint retrieves a course.

URL Parameters:

Parameter

Type

courseid

The identifier of the course to retrieve.

string


Create/Update a Course

Endpoint:

PUT /enrol/nexsis/api/index.php/course/{courseid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/course/C789 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json


       {

         "fullname": "Principles of API Design",

         "shortname": "TECH-231"

         "startdate": "2017-08-16T21:09:30+00:00",

         "categorypath": "/Technology/Design/Modern Programming"

       }

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "courseid": "C789",

         "fullname": "Principles of API Design",

         "shortname": "TECH-231"

         "startdate": "2017-08-16T21:09:30+00:00",

         "categorypath": "/Technology/Design/Modern Programming"

       }

      

This endpoint creates or updates a course.

URL Parameters

Parameter

Type

courseid

The identifier of the course to create or update.

string

Body/JSON Parameters

Parameter

Type

Required

fullname

The full name of the course.

string

Yes

shortname

A shortened or abbreviated name for the course

string

No

startdate

The start date & time of the course.

datetime

No

categorypath

Category node to place the course in, represented as a URI path.

string

No

templateid

The identifier of the course template or shell to use when creating the course for the first time in Moodle.

Note: When suppyling a templateid, the API queues the creation of a course as an adhoc task, instead of creating immediately, to be run with cron due to Moodle's backup and restore, which can be resource intensive, being used when creating a course from a template.

string

No

course_field_shortname

Course custom field to update.  Replace "shortname" with the short name of the course custom field.

string

No


Delete a Course

Endpoint:

DELETE /enrol/nexsis/api/index.php/course/{courseid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/course/C789 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint deletes a course.

URL Parameters

Parameter

Type

courseid

The identifier of the course to delete.

string


List Enrollments in a Course

Endpoint:

GET /enrol/nexsis/api/index.php/course/{courseid}/enrol

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789/enrol HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       [

           {

               "userenrol_id": "6",

               "enrol": "manual",

               "enrolstatus": "0",

               "enrolstartdate": "0",

               "enrolenddate": "0",

               "firstname": "Test",

               "lastname": "User",

               "email": "tuser@example.com",

               "idnumber": "U19913",

               "role": "Student"

           },

           {

               "userenrol_id": "4",

               "enrol": "nexsis",

               "enrolstatus": "0",

               "enrolstartdate": "0",

               "enrolenddate": "0",

               "firstname": "Test2",

               "lastname": "User",

               "email": "t2user@example.com",

               "idnumber": "U14845",

               "role": "Student"

           }

       ]


URL Parameters

Parameter

Type

courseid

The identifier of the course.

string


Get Category Grades

Endpoint:

GET /enrol/nexsis/api/index.php/course/{courseid}/categorygrade/{catid}

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789/categorygrade/6 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       [

           {

               "user_idnumber": "u12345",

               "itemid": "2",

               "internal_userid": "5",

               "rawgrade": null,

               "rawgrademax": "100.00000",

               "rawgrademin": "0.00000",

               "rawscaleid": null,

               "usermodified": null,

               "finalgrade": "80.00000",

               "hidden": "0",

               "locked": "0",

               "locktime": "0",

               "exported": "0",

               "overridden": "0",

               "excluded": "0",

               "feedback": null,

               "feedbackformat": "0",

               "information": null,

               "informationformat": "0",

               "timecreated": null,

               "timemodified": "1590008438",

               "aggregationstatus": "used",

               "aggregationweight": "0.50000",

               "gradeid": "6",

               "categoryid": "2"

           },

           {

               "user_idnumber": "u67890",

               "itemid": "2",

               "internal_userid": "4",

               "rawgrade": null,

               "rawgrademax": "100.00000",

               "rawgrademin": "0.00000",

               "rawscaleid": null,

               "usermodified": null,

               "finalgrade": "40.00000",

               "hidden": "0",

               "locked": "0",

               "locktime": "0",

               "exported": "0",

               "overridden": "0",

               "excluded": "0",

               "feedback": null,

               "feedbackformat": "0",

               "information": null,

               "informationformat": "0",

               "timecreated": null,

               "timemodified": "1590518968",

               "aggregationstatus": "used",

               "aggregationweight": "0.50000",

               "gradeid": "12",

               "categoryid": "2"

           }

       ]

      

URL Parameters

Parameter

Type

courseid

The identifier of the course.

string

catid

The identifier of the grade category.

int


Optional GET Parameters

Example using GET parameter to filter by user IDs:

GET /enrol/nexsis/api/index.php/course/C789/categorygrades/3?userid[]=u12345&userid[]=u67890

      

Key

Value

userid[]

User IDs to filter by. This is an array parameter, so you can pass multiple userid[]s.


Override Category Grades

Endpoint:

PUT /enrol/nexsis/api/index.php/course/{courseid}/categorygrade/{catid}/{userid}/{grade}

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789/categorygrade/6/U12345/80 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

           "user_idnumber": "eli",

           "id": "8",

           "itemid": "4",

           "internal_userid": "5",

           "rawgrade": null,

           "rawgrademax": "100.00000",

           "rawgrademin": "0.00000",

           "rawscaleid": null,

           "usermodified": null,

           "finalgrade": "80.00000",

           "hidden": "0",

           "locked": "0",

           "locktime": "1590520163",

           "exported": "0",

           "overridden": "1590520163",

           "excluded": "0",

           "feedback": null,

           "feedbackformat": "0",

           "information": null,

           "informationformat": "0",

           "timecreated": null,

           "timemodified": "1590008571",

           "aggregationstatus": "used",

           "aggregationweight": "0.50000"

       }

      

URL Parameters

Parameter

Type

courseid

The identifier of the course.

string

catid

The identifier of the grade category.

int

userid

The user whose grade is being overriden

string

grade

Numerical grade value

(any numerical type)


Optional GET Parameters

Example using an optional GET parameter to lock the grade:

PUT /enrol/nexsis/api/index.php/course/C789/categorygrades/3/U12345/80?lock=true

      

Key

Value

lock

set to true or 1 to lock the grade. This will prevent further modifications using the frontend.


Users

Get a User

Endpoint:

GET /enrol/nexsis/api/index.php/user/{userid}

      

Example request:

GET /enrol/nexsis/api/index.php/user/S123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "userid": "S123",

         "username": "student123",

         "firstname": "Student",

         "lastname": "Smith",

         "email": "studentsmith@inst.edu"

       }

      

This endpoint retrieves a user.

URL Parameters

Parameter

Type

userid

The identifier of the user to retrieve.

string


Create/Update a User

Endpoint:

PUT /enrol/nexsis/api/index.php/user/{userid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/user/S123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json


       {

         "username": "student123",

         "firstname": "Student",

         "lastname": "Smith",

         "email": "studentsmith@inst.edu"

       }

      

Example request (URL-encoded):

PUT /enrol/nexsis/api/index.php/user/S123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/x-www-form-urlencoded


       username=student123&firstname=Student&lastname=Smith&email=studentsmith%40inst.edu

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "userid": "S123",

         "username": "student123",

         "firstname": "Student",

         "lastname": "Smith",

         "email": "studentsmith@inst.edu"

       }

      

This endpoint creates or updates a user.

URL Parameters

Parameter

Type

userid

The identifier of the user to create or update.

string

Body/JSON Parameters

Parameter

Type

Required

username

The Moodle username of the user.

string

Yes

firstname

The user's first name.

string

Yes

lastname

The user's last name.

string

Yes

email

The user's email address.

string

Yes

idnumber

The user's id number.  This field should be excluded if idnumber is configured as the User ID field in NexSIS settings.

string

No

auth

The user's authentication method.

Default: manual

string

No

lang

The user's preferred language.

Default: site's default language

string

No

password

The user's password.

Note: May be passed as plain text or an MD5 hash

string

No

timezone

The user's timezone.

Default: site's default timezone

string

No

url

string

No

institution

string

No

department

string

No

address

string

No

city

string

No

country

string

No

icq

string

No

skype

string

No

yahoo

string

No

aim

string

No

msn

string

No

phone1

string

No

phone2

string

No

policyagreed

Default: false

boolean

No

middlename

string

No

alternatename

string

No

tenant

string


No


cohort0

cohort1

cohort2

cohort3

cohort4

cohort5

cohort6

cohort7

cohort8

cohort9

Note: The Cohort ID to add the user to.  The user can be added to up to 10 cohorts at once using 0-9.


string


No



Delete a User

Endpoint:

DELETE /enrol/nexsis/api/index.php/user/{userid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/user/S123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint deletes a user.

URL Parameters

Parameter

Type

userid

The identifier of the user to delete.

string


Enrolments

List User Enrolments

Endpoint:

GET /enrol/nexsis/api/index.php/user/{userid}/enrol

      

Example request:

GET /enrol/nexsis/api/index.php/user/S123/enrol HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       [

         {

           "courseid": "C789",

           "fullname": "Principles of API Design",

           "shortname": "TECH-231"

           "startdate": "2017-08-16T21:09:30+00:00",

           "roles": [

             "student"

           ]

         },

         {

           "courseid": "C889",

           "fullname": "Principles of API Design II",

           "shortname": "TECH-331"

           "startdate": "2017-08-16T21:09:30+00:00",

           "roles": [

             "student"

           ]

         }

       ]

      

This endpoint retrieves all enrolments for a user.

URL Parameters

Parameter

Type

userid

The identifier of the user.

string


Optional GET Parameters

Example using GET parameter to list only NexSIS enrollments:

GET /enrol/nexsis/api/index.php/user/{userid}/enrol?plugin=nexsis

      

Key

Value

plugin

Enrolment plugin to filter by, e.g. "nexsis" or "manual"


Enrol a User in a Course

Endpoint:

PUT /enrol/nexsis/api/index.php/user/{userid}/enrol/{courseid}

      


Example request:

PUT /enrol/nexsis/api/index.php/user/S123/enrol/C789 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/x-www-form-urlencoded


       {

         "roleid": "student"

       }

      

This endpoint creates or updates a user enrolment in a course.

URL Parameters

Parameter

Type

userid

The identifier of the user to enrol.

string

courseid

The identifier of the course to be enroled in.

string

Body/JSON Parameters

Parameter

Type

Required

roleid

The identifier of the role to assign the user in the course.

string

No

timestart

Date & time that the user's enrolment begins.

datetime

No

timeend

Date & time that the user's enrolment ends.

datetime

No


Unenrol a User from a Course

Endpoint:

DELETE /enrol/nexsis/api/index.php/user/{userid}/enrol/{courseid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/user/S123/enrol/C789 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

This endpoint unenrols a user from a course.

URL Parameters

Parameter

Type

userid

The identifier of the user to unenrol.

string

courseid

The identifier of the course to be unenroled from.

string


Optional GET Parameters

Example using optional GET parameter to delete only NexSIS enrolments:

DELETE /enrol/nexsis/api/index.php/user/{userid}/enrol/{courseid}?plugin=nexsis

      

Key

Value

plugin

Enrolment plugin to filter by, e.g. "nexsis" or "manual"


Course Groups

List Course Groups

Endpoint:

GET /enrol/nexsis/api/index.php/course/{courseid}/group

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789/group HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       [

         {

           "groupid": "G1",

           "name": "Group 1",

           "description": "Group 1..."

         },

         {

           "groupid": "G2",

           "name": "Group 2",

           "description": "Group 2..."

         },

         {

           "groupid": "G3",

           "name": "Group 3",

           "description": "Group 3..."

         }

       ]

      

This endpoint retrieves all groups for a given course.

URL Parameters

Parameter

Type

courseid

The identifier of the course to retrieve a list of groups for.

string


Get a Course Group

Endpoint:

GET /enrol/nexsis/api/index.php/course/{courseid}/group/{groupid}

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789/group/G1 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      


Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "groupid": "G1",

         "name": "Group 1",

         "description": "Group 1..."

       }

      

This endpoint retrieves a group for a given course.

URL Parameters

Parameter

Type

courseid

The identifier of the course that the group is in.

string

groupid

The identifier of the group.

string


Create/Update a Course Group

Endpoint:

PUT /enrol/nexsis/api/index.php/course/{courseid}/group/{groupid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/course/C789/group/G1 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json


       {

         "name": "Group 1",

         "description": "Group 1..."

       }

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "groupid": "G1",

         "name": "Group 1",

         "description": "Group 1..."

       }

      

This endpoint creates or updates a course group.

URL Parameters

Parameter

Type

courseid

The identifier of the course that the group is in.

string

groupid

The identifier of the group to create or update.

string

Body/JSON Parameters

Parameter

Type

Required

name

The name of the group.

string

Yes

description

A description for the group

string

No


Delete a Course Group

Endpoint:

DELETE /enrol/nexsis/api/index.php/course/{courseid}/group/{groupid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/course/C789/group/G1 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint deletes a course group.

URL Parameters

Parameter

Type

courseid

The identifier of the course that the group is in.

string

groupid

The identifier of the group to delete.

string


Add/Update a Course Group User

Endpoint:

PUT /enrol/nexsis/api/index.php/course/{courseid}/group/{groupid}/user/{userid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/course/C789/group/G1/user/S123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint adds a user to a course group.

URL Parameters

Parameter

Type

courseid

The identifier of the course that the group is in.

string

groupid

The identifier of the group to add the user to.

string

userid

The identifier of the user to add.

string


Remove a Course Group User

Endpoint:

DELETE /enrol/nexsis/api/index.php/course/{courseid}/group/{groupid}/user/{userid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/course/C789/group/G1/user/S123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint removes a user from a course group.

URL Parameters

Parameter

Type

courseid

The identifier of the course that the group is in.

string

groupid

The identifier of the group to remove the user from.

string

userid

The identifier of the user to remove.

string


Course Completions

Get User Course Completion

Endpoint:

GET /enrol/nexsis/api/index.php/course/{courseid}/user/{userid}/completion

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789/user/U123/completion HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

{
"id": "24227",
"userid": "16860",
"course": "118",
"timeenrolled": "0",
"timestarted": "0",
"timecompleted": "1667289600",
"reaggregate": "0
}

     

This endpoint retrieves the user's course completion.

URL Parameters:

Parameter

Type

courseid

The identifier of the course.

string

userid

The identifier of the Moodle user.

string


Add Course Completion

Endpoint:

POST  /enrol/nexsis/api/index.php/course/{courseid}/user/{userid}/completion/{timestamp_course_completion}

      

Example request (JSON):

POST  /enrol/nexsis/api/index.php/course/C789/user/U123/completion/2026-11-01T08:00:00.000Z HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json

      

This endpoint adds a course completion timestamp for a user in a course if a course completion timestamp does not already exist for the user in the course.

URL Parameters

Parameter

Type

courseid

The identifier of the course.

string

userid

The unique identifier of the Moodle user.

string

timestamp_course_completion
The course completion timestamp.
string


Grades

The NexSIS API retrieves course level grades. These typically correspond to the course "final" grade.


Get User Grades

Endpoint:

GET /enrol/nexsis/api/index.php/user/{userid}/grade

      

Example request:

GET /enrol/nexsis/api/index.php/user/S123/grade HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


     [

           {

             "userid": "S123",

             "courseid": "C789",

             "rawfinalgrade": 92.00,

             "rawgrademax": 100.00,

             "gradeletter": "A-",

             "gradepercent": 0.92,

             "feedback": "Great effort!",

             "timemodified": "2017-08-16T21:09:30+00:00"

           },

           {

             "userid": "S123",

             "courseid": "C799",

             "rawfinalgrade": 950.00,

             "rawgrademax": 1000.00,

             "gradeletter": "A",

             "gradepercent": 0.95,

             "feedback": "Keep it up!",

             "timemodified": "2017-08-15T18:12:21+00:00"

           },

           {

             "userid": "S123",

             "courseid": "C850",

             "rawfinalgrade": 8.40,

             "rawgrademax": 10.00,

             "gradeletter": "B",

             "gradepercent": 0.84,

             "feedback": "",

             "timemodified": "2017-10-02T09:43:54+00:00"

           }

     ]

      

This endpoint retrieves a user's grades.

URL Parameters

Parameter

Type

userid

The identifier of the user to retrieve grades for.

string

Query String Parameters

Parameter

Type

Required

pagenumber

The page of results to retrieve.

Default: 1

integer

No

pagesize

The number of results per page. The maximum value allowed is 250

Default: 100

integer

No

timestart

The starting date/time to retrieve results from.

Default: 1 Year Ago

datetime

No

timeend

The ending date/time to retrieve results thru.

Default: Now

datetime

No


Get Course Grades

Endpoint:

GET /enrol/nexsis/api/index.php/course/{courseid}/grade

      

Example request:

GET /enrol/nexsis/api/index.php/course/C789/grade?pagesize=3 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       [

           {

             "userid": "S123",

             "courseid": "C789",

             "rawfinalgrade": 92.00,

             "rawgrademax": 100.00,

             "gradeletter": "A-",

             "gradepercent": 0.92,

             "feedback": "Great effort!",

             "timemodified": "2017-08-16T21:09:30+00:00"

           },

           {

             "userid": "S234",

             "courseid": "C789",

             "rawfinalgrade": 82.00,

             "rawgrademax": 100.00,

             "gradeletter": "B-",

             "gradepercent": 0.82,

             "feedback": "",

             "timemodified": "2017-08-16T21:10:30+00:00"

           },

           {

             "userid": "S345",

             "courseid": "C789",

             "rawfinalgrade": 96.00,

             "rawgrademax": 100.00,

             "gradeletter": "A",

             "gradepercent": 0.96,

             "feedback": "Great work!",

             "timemodified": "2017-08-16T21:11:30+00:00"

           }

       ]

   

      

This endpoint retrieves a course's grades.

URL Parameters

Parameter

Type

courseid

The identifier of the course to retrieve grades for.

string

Query String Parameters

Parameter

Type

Required

pagenumber

The page of results to retrieve.

Default: 1

integer

No

pagesize

The number of results per page. The maximum value allowed is 250

Default: 100

integer

No

timestart

The starting date/time to retrieve results from.

Default: 1 Year Ago

datetime

No

timeend

The ending date/time to retrieve results thru.

Default: Now

datetime

No


Endpoint:

GET /enrol/nexsis/api/index.php/course/{parent_courseid}/metalink/{metalink_courseid}

      

Example request:

GET /enrol/nexsis/api/index.php/course/C554/metalink/C553 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "id": "64",

         "enrol": "meta",

         "status": "0"

         "courseid": "2",

         "sortorder": "8",

         "name": null,

         "enrolperiod": "0",

         "enrolstartdate": "0",

         "enrolenddate": "0",

         "expirynotify": "0",

         "expirythreshold": "0",

         "notifyall": "0",

         "password": null,

         "cost": null,

         "currency": null,

         "roleid": "0",

         "customint1": "17",

         "customint2": "2",

         "customint3": null,

         "customint4": null,

         "customint5": null,

         "customint6": null,

         "customint7": null,

         "customint8": null,

         "customchar1": null,

         "customchar2": null,

         "customchar3": null,

         "customdesc1": null,

         "customdesc2": null,

         "customtext1": null,

         "customtext2": null,

         "customtext3": null,

         "timecreated": "1764196640",

         "timemodified": "1764196640"

       }

      

This endpoint retrieves a metalink.

URL Parameters:

Parameter

Type

parent_courseid

The identifier of the parent course.

string

metalink_courseid

The identifier of the metalink course.

string



Endpoint:

PUT /enrol/nexsis/api/index.php/metalink/{parent_courseid}/metalink/{metalink_courseid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/course/C554/metalink/C553 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json


       {

         "group": "new",

         "groupname": "Math Students"

         "groupid": "M1"

       }

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8


       {

         "id": "64",

         "enrol": "meta",

         "status": "0"

         "courseid": "2",

         "sortorder": "8",

         "name": null,

         "enrolperiod": "0",

         "enrolstartdate": "0",

         "enrolenddate": "0",

         "expirynotify": "0",

         "expirythreshold": "0",

         "notifyall": "0",

         "password": null,

         "cost": null,

         "currency": null,

         "roleid": "0",

         "customint1": "17",

         "customint2": "2",

         "customint3": null,

         "customint4": null,

         "customint5": null,

         "customint6": null,

         "customint7": null,

         "customint8": null,

         "customchar1": null,

         "customchar2": null,

         "customchar3": null,

         "customdesc1": null,

         "customdesc2": null,

         "customtext1": null,

         "customtext2": null,

         "customtext3": null,

         "timecreated": "1764196640",

         "timemodified": "1764196640"

       }

      

This endpoint creates a metalink.

URL Parameters

Parameter

Type

parent_courseid

The identifier of the parent course.

string

metalink_courseid

The identifier of the metalink course.

string

Body/JSON Parameters

Parameter

Type

Required

group

Specify "none" for no groups, "new" to create a new group, or an existing Group ID Number to add to an existing group.

string

No

groupname

For creating "new" groups only, specified by "new" value for group parameter, specify the group name for the newly created group.

string

No

groupid

For creating "new" groups only, specified by "new" value in the group parameter, specify the group id for the newly created group.

string

No


Endpoint:

DELETE /enrol/nexsis/api/index.php/course/{parent_courseid}/metalink/{metalink_courseid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/course/C554/metalink/C553 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint deletes a metalink.

URL Parameters

Parameter

Type

parent_courseid

The identifier of the parent course.

string

metalink_courseid

The identifier of the metalink course.

string


Programs

Get Program Allocation

Endpoint:

GET /enrol/nexsis/api/index.php/program/{programid}/user/{userid}

      

Example request:

GET /enrol/nexsis/api/index.php/program/P12/user/U123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

{
"programid": "6",
"userid": "15261",
"certificationid": "0",
"startdate": "1767193200",
"startdatelocked": "1",
"duedate": "1798729200",
"duedatelocked": "1",
"enddate": "1798729200",
"enddatelocked": "1",
"status": "0",
"timesuspended": "1768924417",
"allocationtype": "0",
"id": "20",
"timecreated": "1768924417",
"timemodified": "1768924417",
"usermodified": 0
}

     

This endpoint retrieves a program.

URL Parameters:

Parameter

Type

programid

The identifier of the program.

string

userid

The identifier of the Moodle user.

string


Add or Update Program Allocation

Endpoint:

PUT /enrol/nexsis/api/index.php/program/{programid}/user/{userid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/program/P12/user/U123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json

{

"startdate": "2025-12-31T10:00:00",
"duedate": "2026-12-31T10:00:00",
"enddate": "2026-12-31T10:00:00",
"status": "0",

"resetprogram": "0"

}

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

{

 "programid": "6",
"userid": "15261",
"certificationid": "0",
"startdate": 1767193200,
"startdatelocked": 1,
"duedate": 1798729200,
"duedatelocked": 1,
"enddate": 1798729200,
"enddatelocked": 1,
"status": "0",
"timesuspended": "1768921917",
"allocationtype": "0",
"id": "18",
"timecreated": "1768878566",
"timemodified": 1768922311,
 "usermodified": "14755"

}

      

This endpoint creates a new program allocation for a user or updates an existing one.

URL Parameters

Parameter

Type

programid

The identifier of the program.

string

userid

The unique identifier of the Moodle user.

string

Body/JSON Parameters

Parameter

Type

Required

startdate

The start date of the program allocation.

datetime

No

enddate

The end date of the program allocation.

datetime

No

duedate

The due date of the program allocation.

datetime

No

status
 The status of the allocation. Use 1 for Active or 0 for Suspended.

int


No

resetprogram
Set to 1 to reset the user's progress in the program.

int


No



Remove Program Allocation

Endpoint:

DELETE /enrol/nexsis/api/index.php/program/{programid}/user/{userid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/program/P12/user/U123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint drops a user from a specific program, removing their allocation and associated records.

URL Parameters

Parameter

Type

programid

The identifier of the program.

string

userid

The unique identifier of the Moodle user.

string


Certifications

Get Certification Allocation

Endpoint:

GET /enrol/nexsis/api/index.php/certification/{certificationid}/user/{userid}

      

Example request:

GET /enrol/nexsis/api/index.php/certification/C12/user/U123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

{
"certificationid": "5",
"userid": "15261",
"status": "0",
"timesuspended": "1768925120",
"allocationtype": "0",
"currentprogramid": null,
"isrecertification": "0",
"graceperiodends": 0,
"graceperiodendslocked": 0,
"nextstartdate": 0,
"id": "14",
"timecreated": "1768925120",
"timemodified": 1768925210,
"usermodified": "14755"
}

     

This endpoint retrieves the current certification allocation details for a specific user.

URL Parameters:

Parameter

Type

certificationid

The identifier of the certification.

string

userid

The identifier of the Moodle user.

string


Add or Update Certification Allocation

Endpoint:

PUT  /enrol/nexsis/api/index.php/certification/{certificationid}/user/{userid}

      

Example request (JSON):

PUT  /enrol/nexsis/api/index.php/certification/C12/user/U123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json

{
"startdate": "2025-12-31T10:00:00",
"duedate": "2026-12-31T10:00:00",
"expirydate": "2026-12-31T10:00:00",
"certifieddate": "2026-12-31T10:00:00",
"suspendstatus": "0",
 "revokedcertification": "0"

}

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

{
"certificationid": "5",
"userid": "15261",
"status": "0",
"timesuspended": "1768925120",
"allocationtype": "0",
"currentprogramid": null,
"isrecertification": "0",
"graceperiodends": 0,
"graceperiodendslocked": 0,
"nextstartdate": 0,
"id": "14",
"timecreated": "1768925120",
"timemodified": 1768925210,
 "usermodified": "14755"

}

      

This endpoint creates a new certification allocation for a user or updates an existing one if it already exists.

URL Parameters

Parameter

Type

certificationid

The identifier of the certification.

string

userid

The unique identifier of the Moodle user.

string

Body/JSON Parameters

Parameter

Type

Required

startdate

The start date of the certification allocation.

datetime

No

duedate

The due date of the certification allocation.

datetime

No

expirydate

The expiry date of the certification allocation.

datetime

No

certifieddate
The certified date of the certification allocation.

datetime

No

suspendstatus

The status of the allocation.  Use 1 for Active or 0 for suspended.

int

No

revokedcertification
Set to 1 to revoke the user's current certification completion.
intNo


Remove Certification Allocation

Endpoint:

DELETE /enrol/nexsis/api/index.php/certification/{certificationid}/user/{userid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/certification/C12/user/U123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint drops a user from a specific program, removing their allocation and associated records.

URL Parameters

Parameter

Type

certificationid

The identifier of the certification.

string

userid

The unique identifier of the Moodle user.

string


Job Assignments

Get User Job Assignments

Endpoint:

GET /enrol/nexsis/api/index.php/organisation/user/{idnumber}/job

      

Example request:

GET //enrol/nexsis/api/index.php/organisation/user/U123/job HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8
[
{
"id": "4",
"tenantid": "1",
"userid": "U123",
"positionid": "P3",
"departmentid": "D5",
"startdate": "1767193200",
"enddate": "1798729200",
"timecreated": "1771298867",
"timemodified": "1771298867",
"usermodified": 0,
}
]

     

This endpoint retrieves list of jobs assigned to the user.

URL Parameters:

Parameter

Type

userid

The identifier of the Moodle user.

string


Add or Update User Job Assignment

Endpoint:

PUT /enrol/nexsis/api/index.php/organisation/user/{userid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/organisation/user/U123 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json
{
"departmentid": "D5",
"positionid": "P4",
"startdate": "2025-12-31T10:00:00",
"enddate": "2026-12-31T10:00:00"
}

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8
{
"id": "4",
"tenantid": "1",
"userid": "U123",
"positionid": "P3",
"departmentid": "D5",
"startdate": 1767193200,
"enddate": 1798729200,
"timecreated": "1771298867",
"timemodified": 1771299100,
"usermodified": "14755"
}

      

This endpoint creates a new certification allocation for a user or updates an existing one if it already exists.

URL Parameters

Parameter

Type

userid

The unique identifier of the Moodle user.

string

Body/JSON Parameters

Parameter

Type

Required

departmentid

The unique identifier of the organization department.

string

Yes

postionid

The unique identifier of the organization position.

string

Yes

startdate

The start date of the job assignment.

datetime

No

enddate

The end date of the job assignment.

datetime

No


Remove User Job Assignment

Endpoint:

DELETE /enrol/nexsis/api/index.php/organisation/user/{userid}/department/{departmentid}/position/{positionid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/organisation/user/U123/department/D5/position/P4 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint deletes a user's job assignment.

URL Parameters

Parameter

Type

userid

The unique identifier of the Moodle user.

string

departmentid
The unique identifier of the organization department.
string
positionid
The unique identifier of the organization position.
string


Direct Managers

Get Organisation User Manager

Endpoint:

GET /enrol/nexsis/api/index.php/organisation/user/{userid}/manager

      

Example request:

GET /enrol/nexsis/api/index.php/organisation/user/U123/manager HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8
[
{
"id": "12191",
"userid": "U123",
"managerid": "M123",
"tenantid": "1",
"permissions": "4",
"timecreated": "2026-03-03T10:21:15-05:00",
"timemodified": "2026-03-03T10:21:15-05:00",
"usermodified": 0
}
]

     

This endpoint retrieves list of jobs assigned to the user.

URL Parameters:

Parameter

Type

userid

The identifier of the Moodle user.

string


Assign Manager to Organisation User

Endpoint:

PUT /enrol/nexsis/api/index.php/organisation/user/{userid}/manager/{reportsto_userid}

      

Example request (JSON):

PUT /enrol/nexsis/api/index.php/organisation/user/U123/manager/M456 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

       Content-Type: application/json
{
"keepexisting": 1,
"perm_allocate_programs": 0,
"perm_view_reports": 0,
"perm_be_notified": 1
}

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8
{
"id": 12191,
"userid": “U123”,
"managerid": “M456”,
"tenantid": 1,
"permissions": 4,
"timecreated": "2026-03-03T10:21:15-05:00",
"timemodified": "2026-03-03T10:21:15-05:00",
"usermodified": "14755"
}

      

This endpoint assigns a manager to a specific organisation user within a tentant and sets the manager's permissions.

URL Parameters

Parameter

Type

userid

The unique identifier of the Moodle user.

string

reportsto_userid
The unique identifier of the manager.
string

Body/JSON Parameters

Parameter

Type

Required

keepexisting

This option should be "1" or "0" and will default to "1" if not specified.  If "1" this option will keep existing managers and add new ones.  If "0" this option will replace existing managers.

int

No

perm_allocate_programs

This option should be "1" or "0" and will default to "1" if not specified.  If "1" this option allows permission to allocate managed users to programs and certifications.  If "0" this option will deny permission to allocate managed users to programs and certifications.

int

No

perm_view_reports

This option should be "1" or "0" and will default to "1" if not specified.  If "1" this option allows permission to view reports on manged users.  If "0" this option will deny permission to view reports on managed users.

int

No

perm_be_notified

This option should be "1" or "0" and will default to "1" if not specified.  If "1" this option allows permission to receive notifications on managed users.  If "0" this option will deny permission to receive notifications on managed users.

int

No


Remove an Organisation User Manager

Endpoint:

DELETE /enrol/nexsis/api/index.php/organisation/user/{userid}/manager/{reportsto_userid}

      

Example request:

DELETE /enrol/nexsis/api/index.php/organisation/user/U123/manager/M12 HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

      

This endpoint deletes the relationship between a user and a manager.

URL Parameters

Parameter

Type

userid

The unique identifier of the Moodle user.

string

reportsto_userid
The unique identifier of the manager.
string


Logs

Get Logs

Endpoint:

GET /enrol/nexsis/api/index.php/logs

      

Example request:

GET /enrol/nexsis/api/index.php/logs?limit=10&offset=0&level=fatal,error,warning,info HTTP/1.1

       Authorization: Bearer {token}

       Host: example.moodle.com

       Accept: */*

      

Example response:

HTTP/1.1 200 OK

       Content-Type: application/json; charset=utf-8

{
"id": "2122",
"date_created": "2025-12-26 14:36:33",
"level": "info",
"message": "Course completion already exists",
"detail": "Time completed for course 118 already exists for student 16860",
"params": "",
"request_method": "",
"request_url": "",
"request_body": "",
"response_body": "",
"response_status_code": null,
"ip": "127.0.0.1",
"user_agent": "Unknown User Agent"
}

     

This endpoint retrieves a filtered list of NexSIS logs.

URL Parameters:

Parameter

Type

limit

The maximum number of log entries to return (e.g., 10)

int

offset

The starting point for the results (used for pagination).

int

level
Comma-separated list of log severities to include (e.g., fatal, error, warning, info, debug)
string


Errors

The NexSIS API uses the following error codes:

Error Code

Meaning

400

Bad Request -- Your request is invalid.

401

Unauthorized -- Your API key is wrong.

404

Not Found -- The specified resource could not be found.

405

Method Not Allowed -- You tried to access a resource with an invalid method.

500

Internal Server Error -- We had a problem with our server. Try again later.

503

Service Unavailable -- We're temporrily offline for maintenance. Please try again later.







Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.