Create Enrolment
Overview
An enrolment is the process of registering a contact (an individual) into a specific course instance, such as a workshop or class.
The general process for creating an enrolment includes the following steps:
- Identify the course instance: Choose the specific course instance that the contact wants to enrol in.
- Identify the contact: Find the contact (student) who will be enrolling in the course instance.
- Check for availability: Confirm that there is space available in the chosen course instance for the contact to enrol.
- Check for discounts (optional): Review any applicable discounts that the contact may be eligible for and apply them if necessary.
- Enrol the contact: Register the contact into the course instance.
- Process payment: Handle the payment process for the enrolment. This may involve different payment methods depending on your organisation's policies.
- Confirm the enrolment: Once payment has been successfully processed, finalise and confirm the enrolment.
Identify the Course Instance
To begin, you can retrieve a list of courses using the /courses endpoint. Alternatively, you can generate a report using the /report/run endpoint with specific filters and display fields.
Once you have selected a course, use the /course/detail endpoint to access detailed information about the course. To locate specific instances of the course, we recommend using the /course/instance/search endpoint as it is the most flexible for filtering results.
For subsequent API calls, you will require the instanceId and type (w = Workshop, p = Class) from the above requests.
Identify the Contact
Before you start the enrolment process, you need to either create a new contact or identify the existing contact that you want to enrol.
To create a new contact, send a POST request to the /contact endpoint. At a minimum, you'll need to provide the contact's surname.
To identify an existing contact, you can make a GET request to the /contacts/search endpoint. If the search does not return any results, you may need to create a new contact using a POST request to the /contact endpoint.
If you have returning students and want to verify their identity, you can programmatically redirect them to the aXcelerate login page, allowing them to log in and return to your website with an access code. This access code can then be used in a POST request to /user/login API, which will return a contact ID in the response. For more information on this method, please see the ‘Login API’ section in our published API documentation.
Verify the Course Instance has vacancy
If the course is a workshop, you might want to check that there are available spaces to accept an enrolment. This can be done using the data from the previous response from the /course/instance/search endpoint.
Look for the field participantVacancy to verify availability.
Check for applicable discounts (optional)
Using the type, contact ID, instance ID, and original price, send a GET request to /course/discounts.
The response will return any available discounts, including their IDs, and a revised price with the total savings, which can be displayed to the user.
The revised price can be used as the value for 'cost' when calling the /course/enrol endpoint. Additionally, include the discount IDs in the discountIdList parameter.
Enrol
Making a POST request to the /course/enrol endpoint, the minimum requirements are:
- contactID
- instanceID
- type
Typically, if you plan to process a payment during the enrolment process, the usual approach is to enrol the contact on a tentative basis (tentative = true) until the payment has been successfully confirmed.
Enrol Multiple
When enrolling in a workshop, you can enrol multiple contacts in a single POST request to /course/enrolMultiple. Note that this endpoint does not allow for tentative enrolments.
For class enrolments or tentative workshop enrolments, you'll need to make separate POST requests to the /course/enrol endpoint, with the parameter lockInvoiceItems = 0.
Since the invoice is not locked, you can add further enrolments to the same invoice. The response from the initial /course/enrol request will provide an invoiceId value. Use this value in the invoiceID parameter to add the subsequent enrolment to the same invoice.
For the final enrolment, set the lockInvoiceItems value to 1. If not already locked, processing the payment will also lock the invoice items.
You can also use the same invoiceID to enrol the same or additional contacts in a different course.
Process Payment
See Process Payment
Confirm Enrolment
Once the payment has been successful, update the enrolment to be confirmed (tentative = false) by making a POST request to /course/enrol
This will enrol the contact in any associated eLearning and send any documentation required.