Quick Start Guide
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!
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:
clientIdandclientSecretprovided 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/sv6Use this for development and testing
๐ Production Environment
https://www.osteocom.me/sv6Use this for live applications
API Flow Overviewโ
The Content Licensing API follows a simple 4-step process:
- ๐ Authentication - Get access token with your credentials
- ๐ Catalog Access - Retrieve available content catalog
- โ Content Authorization - Authorize customer access to specific content
- ๐ฅ 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โ
{
"clientId": "psiGBHLDxxxxxxdIyDw",
"clientSecret": "QAtSxxxxxxxxxxxxxxK98fPtz1YESrz2JU"
}
Implementation Examplesโ
๐จ JavaScript Example
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 \
-H 'Content-Type: application/json' \
-X POST \
-d '{"clientId": "psiGBHLDxxxxxxdIyDw", "clientSecret": "QAtSxxxxxxxxxxxxxxK98fPtz1YESrz2JU"}' \
<urlPrefix>/contentLicensing_login
Responseโ
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
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โ
{
"clientId": "psiGBHLDxxxxxxdIyDw"
}
Implementation Examplesโ
๐จ JavaScript Example
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 \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-X POST \
-d '{"clientId": "<clientId>"}' \
<urlPrefix>/contentLicensing_catalog
Responseโ
{
"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"
}
]
}
]
}
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โ
{
"clientId": "psiGBHLDxxxxxxdIyDw",
"userId": "user_12345",
"products": [
{
"productId": "66d579675f2xxxxxxf15e4d3",
"price": 100
}
]
}
userId: Unique string identifier for your customer (format is your choice)productId: TheidChannelfrom the catalog response- See the FAQ section for more details
Implementation Examplesโ
๐จ JavaScript Example
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 \
-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โ
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600
}
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โ
{
"userId": "user_12345",
"videoId": "591441cexxxxxcc4f8d653",
"clientId": "psiGBHLDxxxxxxdIyDw",
"userAccessKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Implementation Examplesโ
๐จ JavaScript Example
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 \
-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โ
{
"tokenAuthVideo": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 900
}
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
clientIdandclientSecretare 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
productIdmatches anidChannelfrom your catalog - Verify the
userIdformat is consistent - Check that the product is included in your agreed catalog
๐ฅ Video Access Problemsโ
Problem: Video token generation fails
Solution:
- Ensure the
userAccessKeyis from a successful authorization - Verify the
videoIdexists 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
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โ
- ๐ Read the full API documentation: API Documentation (Latest)
- ๐ผ๏ธ Implement video playback: Iframe-Based Video Access
- ๐งช Test with Postman: Download our collection
- โ Need help? Check our FAQ or contact us
๐จ Important Remindersโ
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
- 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!