Skip to main content
Docs · Getting started

SCORM API Code Examples

Updated

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:

  1. TypeScript/Node.js (opens in a new tab) - Server-side TypeScript examples
  2. JavaScript (opens in a new tab) - Browser and Node.js JavaScript examples
  3. Python (opens in a new tab) - Python client examples
  4. cURL (opens in a new tab) - Command-line examples for testing
  5. Frameworks (opens in a new tab) - 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:

  1. Environment Variables: API keys stored in environment variables
  2. Error Handling: Comprehensive error handling with retry logic
  3. Version Conflicts: Proper handling of optimistic locking
  4. Rate Limiting: Respect rate limits and handle 429 responses
  5. Security: Prefer server-side calls for authenticated routes; never commit real API keys
  6. 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:

  1. Follow the existing code style
  2. Include error handling
  3. Add comments explaining key concepts
  4. Test the example before submitting
  5. Update this README with links to new examples