In version 1.2, we introduced the rest API method for enrolling and removing users from a course. This method is simple and secure and allows your flowmattic or other automation not to be installed on the same Wordpress site as your WPCourseWare Instance.
Once 1.2 is installed, you will find a new menu in settings called 'WPC Automation' When opening, you will see a new admin menu that looks like the below:
For enrollment, you need to set an API key which can be custom or randomly generated using button (2) this, when set, will be your X-WPC-Automation-Key, which should be named as such and in your header to authenticate your requests to enroll or remove a user from a course
The API URL is available for you to copy in (4)
You then need to set your Automator up to include the following information (Below is a Flowmattic Screenshot)
You need to take the API endpoint (4) from above and paste it into (1), AND you need to make sure you are sending as a JSON with parameters your API key should be set as in this example at (3;) the mandatory parameters are
- Course-id (this is the published course id, not the page or post id,) i.e 2 in the example below
- Optionally if this is a new user, you can set a username (6) in the image above
This will then allow you to enroll a user using the rest API using the plugin