Skip to main content

Quick Start Guide

What You'll Learn

This section provides practical request and response examples with client-side implementations using JavaScript and cURL to demonstrate how to interact with the API.

Note: These examples always follow the LATEST version of the API!

Security Notice

The JavaScript examples show how to test integration in your local environment. Remember to store sensitive information securely in production environments!

Prerequisitesโ€‹

Before you start, make sure you have:

  • โœ… Valid credentials: clientId and clientSecret provided by Osteocom
  • โœ… API environment: Choose between test and production URLs
  • โœ… Development setup: JavaScript runtime or cURL for testing

Environment URLsโ€‹

๐Ÿงช Test Environment

https://test.osteocom.me/sv6

Use this for development and testing

๐Ÿš€ Production Environment

https://www.osteocom.me/sv6

Use this for live applications

API Flow Overviewโ€‹

The Content Licensing API follows a simple 4-step process:

  1. ๐Ÿ” Authentication - Get access token with your credentials
  2. ๐Ÿ“š Catalog Access - Retrieve available content catalog
  3. โœ… Content Authorization - Authorize customer access to specific content
  4. ๐ŸŽฅ Video Access - Generate video tokens for playback

Step 1: Authentication APIโ€‹

Get your access token to authorize all subsequent API calls.

Endpointโ€‹

POST /contentLicensing_login

Request Payloadโ€‹

Authentication Request
{
"clientId": "psiGBHLDxxxxxxdIyDw",
"clientSecret": "QAtSxxxxxxxxxxxxxxK98fPtz1YESrz2JU"
}

Implementation Examplesโ€‹

๐ŸŸจ JavaScript Example
JavaScript Implementation
const authResponse = await fetch(loginApi, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
clientId: clientId,
clientSecret: secretKey
}),
});

const authData = await authResponse.json();
const accessToken = authData.token;
๐Ÿ“Ÿ cURL Example
cURL Implementation
curl \
-H 'Content-Type: application/json' \
-X POST \
-d '{"clientId": "psiGBHLDxxxxxxdIyDw", "clientSecret": "QAtSxxxxxxxxxxxxxxK98fPtz1YESrz2JU"}' \
<urlPrefix>/contentLicensing_login

Responseโ€‹

Authentication Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Success!

Store the returned token securely - you'll need it for all subsequent API calls as a Bearer token in the Authorization header.

Step 2: Catalog APIโ€‹

Retrieve the content catalog that has been pre-agreed between you and Osteocom.

Endpointโ€‹

POST /contentLicensing_catalog

Request Payloadโ€‹

Catalog Request
{
"clientId": "psiGBHLDxxxxxxdIyDw"
}

Implementation Examplesโ€‹

๐ŸŸจ JavaScript Example
JavaScript Implementation
const catalogResponse = await fetch(catalogApi, {
method: "POST",
headers: {
"Authorization": `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ clientId: clientId }),
});

const catalogData = await catalogResponse.json();
๐Ÿ“Ÿ cURL Example
cURL Implementation
curl \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-X POST \
-d '{"clientId": "<clientId>"}' \
<urlPrefix>/contentLicensing_catalog

Responseโ€‹

Catalog Response (Sample)
{
"catalog": [
{
"idChannel": "66d579675f2xxxxxxf15e4d3",
"authors": [
{
"name": "Dr. Smith",
"image": "https://cdn.osteocom.me/authors/dr-smith.jpg"
}
],
"background": "https://cdn.osteocom.me/backgrounds/bg1.jpg",
"cover": "https://cdn.osteocom.me/covers/cover1.jpg",
"trailer": "https://cdn.osteocom.me/trailers/trailer1.mp4",
"title": "Advanced Orthopedic Surgery",
"subtitle": "Master advanced surgical techniques",
"htmlDescription": "<p>Comprehensive course on modern orthopedic procedures...</p>",
"price": 100,
"video": [
{
"videoId": "video_001",
"title": "Introduction to Arthroscopy",
"duration": "45:30",
"videoQuality": "1080p"
}
]
}
]
}
Catalog Data

Use the idChannel from the catalog response as the productId in the next step for content authorization.


Step 3: Content Access Authorizationโ€‹

Authorize customer access to specific content after purchase.

Endpointโ€‹

POST /contentLicensing_contentAccessAuthorization

Request Payloadโ€‹

Content Authorization Request
{
"clientId": "psiGBHLDxxxxxxdIyDw",
"userId": "user_12345",
"products": [
{
"productId": "66d579675f2xxxxxxf15e4d3",
"price": 100
}
]
}
Required Fields
  • userId: Unique string identifier for your customer (format is your choice)
  • productId: The idChannel from the catalog response
  • See the FAQ section for more details

Implementation Examplesโ€‹

๐ŸŸจ JavaScript Example
JavaScript Implementation
const accessAuthResponse = await fetch(urlAccessApi, {
method: "POST",
headers: {
"Authorization": `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
clientId: clientId,
userId: "user_12345",
products: [{
productId: "66d579675f2xxxxxxf15e4d3",
price: 100
}],
}),
});

const authData = await accessAuthResponse.json();
const userAccessToken = authData.token;
๐Ÿ“Ÿ cURL Example
cURL Implementation
curl \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"clientId": "<clientId>",
"userId": "user_12345",
"products": [{"productId": "66d579675f2xxxxxxf15e4d3", "price": 100}]
}' \
<urlPrefix>/contentLicensing_contentAccessAuthorization

Responseโ€‹

Content Authorization Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600
}
User Access Token

Store the returned user access token - you'll need it to generate video access tokens for this specific user and channel.


Step 4: Video Access APIโ€‹

Generate video tokens for actual video playback.

Endpointโ€‹

POST /contentLicensing_videoAccess

Request Payloadโ€‹

Video Access Request
{
"userId": "user_12345",
"videoId": "591441cexxxxxcc4f8d653",
"clientId": "psiGBHLDxxxxxxdIyDw",
"userAccessKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Implementation Examplesโ€‹

๐ŸŸจ JavaScript Example
JavaScript Implementation
const videoResponse = await fetch(urlVideoApi, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify({
userId: "user_12345",
videoId: "591441cexxxxxcc4f8d653",
clientId: clientId,
userAccessKey: userAccessToken,
}),
});

const videoData = await videoResponse.json();
const videoToken = videoData.tokenAuthVideo;
๐Ÿ“Ÿ cURL Example
cURL Implementation
curl \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"clientId": "<clientId>",
"userId": "user_12345",
"videoId": "591441cexxxxxcc4f8d653",
"userAccessKey": "<userAccessToken>"
}' \
<urlPrefix>/contentLicensing_videoAccess

Responseโ€‹

Video Access Response
{
"tokenAuthVideo": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 900
}
Final Step!

Use the tokenAuthVideo in an iframe to display the video player. See our detailed guide: Iframe-Based Video Access


Common Issues & Troubleshootingโ€‹

๐Ÿ” Authentication Issuesโ€‹

Problem: Getting 401 Unauthorized
Solution:

  • Verify your clientId and clientSecret are correct
  • Ensure you're using the right environment URL
  • Check that credentials are properly formatted in the request

๐Ÿšซ Authorization Failuresโ€‹

Problem: Content authorization fails
Solution:

  • Confirm the productId matches an idChannel from your catalog
  • Verify the userId format is consistent
  • Check that the product is included in your agreed catalog

๐ŸŽฅ Video Access Problemsโ€‹

Problem: Video token generation fails
Solution:

  • Ensure the userAccessKey is from a successful authorization
  • Verify the videoId exists in the authorized content
  • Check that tokens haven't expired (15 minutes for video tokens)

โฐ Token Expirationโ€‹

Problem: Tokens expire during testing
Solution:

  • Authentication tokens: Last longer, regenerate as needed
  • User access tokens: 1 hour expiration, refresh when needed
  • Video tokens: 15 minutes, generate just before video playback
Debug Tip

Always check the response body for detailed error messages. The API provides helpful debugging information!


Next Stepsโ€‹

๐ŸŽฏ You're ready to integrate! Here's what to do next:

๐Ÿ“‹ Implementation Checklistโ€‹

  • Test Authentication: Verify your credentials work with Step 1
  • Explore Catalog: Retrieve and review your available content
  • Test Authorization: Try authorizing a test user for content access
  • Implement Video Player: Use the iframe approach for video playback

๐Ÿ“š Additional Resourcesโ€‹

  1. ๐Ÿ“– Read the full API documentation: API Documentation (Latest)
  2. ๐Ÿ–ผ๏ธ Implement video playback: Iframe-Based Video Access
  3. ๐Ÿงช Test with Postman: Download our collection
  4. โ“ Need help? Check our FAQ or contact us

๐Ÿšจ Important Remindersโ€‹

Production Checklist

Before going live, ensure you:

  • โœ… Use production environment URL https://www.osteocom.me/sv6
  • โœ… Store credentials securely (never in client-side code)
  • โœ… Implement proper error handling
  • โœ… Test with real user scenarios
  • โœ… Validate token expiration handling
Best Practices
  • Security: Always use HTTPS and secure credential storage
  • Performance: Cache catalog data appropriately
  • User Experience: Handle token expiration gracefully
  • Testing: Test thoroughly in the test environment first

๐ŸŽ‰ Ready to start building amazing video experiences with Osteocom!