Customizing an API
Before customizing a ready made API provided by Open Edx itself, you need to determine its default scope. The default scope determines its operation, parameters/arguments it takes and it returns.
Example of User Enrollment API
The default scope of user enrollment API is that it only enrolls logged-in user and not the specific user passed to it. The input parameters are user, course_details and mode. The output/response parameter is simply a message field signalling that the operation succeeds or fails.
Description of modifications
Now, to increase the capability of the user enrollment API, it has to customize according to the requirements. The requirements is that the user enrollment API must enroll a specified user using his email. If the user does not exist on the Open Edx platform, then it must create a pre-enrollment entry. Moreover, the API should also cater the need for unenrolling a specified user which can be done by the addition of a parameter called unenroll.