SCORM API Code Examples
Working code examples for integrating with the SCORM API in various languages and frameworks.
Overview
This library contains practical code examples for common SCORM API use cases. Server-side samples keep API keys in environment variables. Browser-oriented snippets (e.g. some React demos) are illustrative; route API calls through your backend or a serverless proxy so secrets never ship to end users.
Organization
Examples are organized by:
- Language: TypeScript, JavaScript, Python, cURL
- Framework: React, Next.js, Express.js, WordPress
- Use Case: Upload, launch, tracking, webhooks, error handling
Quick Start
Choose your language/framework and follow the examples:
- TypeScript/Node.js - Server-side TypeScript examples
- JavaScript - Browser and Node.js JavaScript examples
- Python - Python client examples
- cURL - Command-line examples for testing
- Frameworks - Framework-specific examples (React, Next.js, Express, WordPress)
Common Use Cases
1. Upload a SCORM Package
2. Launch a Learning Session
3. Update CMI Data
4. Handle Version Conflicts
5. Webhook Handling
6. Error Handling with Retry
Framework Examples
React
Next.js
Express.js
WordPress
Best Practices
All examples follow these best practices:
- Environment Variables: API keys stored in environment variables
- Error Handling: Comprehensive error handling with retry logic
- Version Conflicts: Proper handling of optimistic locking
- Rate Limiting: Respect rate limits and handle 429 responses
- Security: Prefer server-side calls for authenticated routes; never commit real API keys
- Type Safety: TypeScript examples include full type definitions
Testing Examples
Clone the repository, set CONNECT_API_KEY, CONNECT_API_BASE_URL, and
CONNECT_TENANT_ID, then run the chosen file with the language runtime shown in
that example. The repository does not expose generic npm run example:*
scripts.
Contributing
When adding new examples:
- Follow the existing code style
- Include error handling
- Add comments explaining key concepts
- Test the example before submitting
- Update this README with links to new examples
Related Documentation
- API Reference - Complete endpoint documentation
- Getting Started - Quick start guide
- Custom LMS Integration - Platform integration guide
- Error Codes - Error handling reference