Working with REST API Estimated reading: 2 minutes 3 views Summary: Discover how to interact with EazyLMS data using the WordPress REST API. Learn to fetch course metadata, manage student progress, and integrate custom functionality into your e-learning platform efficiently. EazyLMS offers a robust foundation for developers to interact with course data programmatically. By leveraging the WordPress REST API, you can integrate course management, enrollment tracking, and student progress monitoring into external applications, custom dashboards, or mobile interfaces. Accessing Course Data via REST API EazyLMS extends the existing EazyDocs docs custom post type. Because EazyLMS utilizes native post meta to store course-specific configurations—such as course_type, linked_product, and maximum_students—you can retrieve this data using standard WordPress REST API endpoints. To fetch all courses, you would typically filter by the docs post type with a depth constraint, as defined in the How to Migrate Existing WordPress Posts to EazyDocs Single Docs documentation. For administrative tasks, the plugin provides custom endpoints handled in includes/api/rest-api.php to manage course-specific settings and student associations. Custom REST API Endpoints The plugin registers specific routes to streamline administration. These endpoints are designed to interact with the React-powered Course Admin interface. When building custom integrations, ensure that you include the appropriate X-WP-Nonce header for authentication and security validation. Retrieve Course Metadata: Access serialized meta keys like eazylms_options to retrieve features, duration, and skill level settings. Enrollment Management: Use internal AJAX handlers (defined in includes/ajax-actions.php) for real-time enrollment updates, or use the REST API to update post meta if you have administrative privileges. Student Tracking: Retrieve the eazy_topic_data meta key to monitor lesson completion rates and student progress across specific modules. Best Practices for API Integration When working with EazyLMS endpoints, consider the following technical constraints: Dependency Check: Always ensure the EazyDocs plugin is active before making API calls, as the EazyLMS data model relies heavily on the docs post hierarchy. Data Relationships: Refer to the to understand how meta keys are serialized. Proper unserialization is required when reading these values from the REST API response. WooCommerce Sync: If you are integrating with paid courses, remember that enrollment status is often tied to WooCommerce order statuses via hooks in includes/woocommerce/actions.php. // Example: Fetching course posts via WP REST API fetch('/wp-json/wp/v2/docs?depth=0') .then(response => response.json()) .then(data => console.log(data)); For more complex operations, such as manual student enrollment or updating custom labels, refer to the source files in the includes/admin/ directory to see how the core plugin handles these requests internally. Tagged:APIDevelopmentIntegration Working with REST API - PreviousPlugin Directory StructureNext - Working with REST APITemplate Overrides