Getting started overview
To begin using Catalogopolis for video hosting and streaming, the initial steps involve setting up a developer account, obtaining API credentials, and executing a foundational API request. Catalogopolis offers a free Developer Plan designed for evaluation and small-scale projects, providing 10 GB of storage and 50 GB of streaming per month. This plan enables developers to access the core features, including video upload, management, and delivery, without immediate financial commitment.
The Catalogopolis API supports various operations, from uploading and encoding videos to managing live streams and integrating monetization strategies. Developers can interact with the API directly via HTTP requests or leverage one of the available SDKs, which include JavaScript, Python, Ruby, PHP, Java, and Go. These SDKs are designed to abstract away the complexities of direct HTTP interactions, authentication, and error handling, allowing for quicker integration into existing applications.
Authentication for Catalogopolis API requests typically involves an API key and secret, which are generated within the user dashboard. These credentials are used to sign requests, ensuring that only authorized users can perform actions on their video library. Secure handling of these keys is critical, often involving environment variables or secure credential management systems rather than hardcoding them directly into application source code. The process is similar to how many cloud service providers, such as AWS Access Keys, manage credentials for programmatic access.
This guide focuses on the streamlined path to making your first successful API call, specifically uploading a video. Subsequent steps often involve integrating video playback into a web or mobile application, managing video metadata, or exploring advanced features like live streaming and analytics.
Here's a quick reference table outlining the essential steps to get started:
| Step | What to Do | Where |
|---|---|---|
| 1. Sign Up | Create a free Developer Plan account. | Catalogopolis Pricing Page |
| 2. Get API Keys | Generate your API Key and Secret from the dashboard. | Catalogopolis Dashboard > API Settings |
| 3. Install SDK (Optional) | Choose and install your preferred language SDK. | Catalogopolis SDKs Documentation |
| 4. Make First Call | Upload a sample video using the API or an SDK. | Catalogopolis Video Upload Guide |
| 5. Verify Upload | Check the video's status in your Catalogopolis library. | Catalogopolis Dashboard > Video Library |
Create an account and get keys
The first step in utilizing Catalogopolis is to create an account. Catalogopolis offers a Developer Plan that provides 10 GB of storage and 50 GB of streaming bandwidth per month at no cost. This tier is suitable for initial development and testing. To sign up, navigate to the Catalogopolis website and follow the registration process, which typically involves providing an email address and creating a password. Once registered, you will gain access to the Catalogopolis dashboard.
Upon logging into your dashboard, locate the section related to API settings or developer keys. The exact navigation may vary, but it is commonly found under a 'Settings', 'API Access', or 'Developer' menu item. Within this section, you will be able to generate your API Key and API Secret. These two pieces of information are crucial for authenticating your API requests. The API Key identifies your account, while the API Secret is used to sign requests, ensuring their integrity and authenticity. It is a common practice in API design, as outlined in security guidelines like those for Cloudflare API Tokens, to use a pair of credentials for enhanced security.
Important Security Note: Your API Secret should be treated like a password. Do not embed it directly into client-side code (e.g., JavaScript running in a browser) or commit it to public version control repositories. Instead, store it securely, ideally using environment variables, a secrets management service, or a secure server-side configuration. If your API Secret is compromised, you should revoke it immediately from your Catalogopolis dashboard and generate a new one.
After generating your keys, make sure to copy them and store them securely. You will need both the API Key and API Secret for all authenticated API interactions. Some Catalogopolis SDKs may require you to configure these credentials during initialization, while direct HTTP requests will involve including them in headers or as part of a signed payload, as detailed in the Catalogopolis API authentication guide.
Your first request
With your account set up and API credentials in hand, you are ready to make your first API request to Catalogopolis. A common initial request is to upload a video. Catalogopolis provides SDKs in several languages to simplify this process. We will demonstrate with Python and JavaScript examples.
Using the Python SDK
First, install the Catalogopolis Python SDK:
pip install catalogopolis
Then, you can use the following Python code to upload a video. Replace YOUR_API_KEY, YOUR_API_SECRET, and path/to/your/video.mp4 with your actual credentials and video file path.
import os
from catalogopolis import Client
# Retrieve API keys from environment variables for security
api_key = os.getenv('CATALOGOPOLIS_API_KEY', 'YOUR_API_KEY')
api_secret = os.getenv('CATALOGOPOLIS_API_SECRET', 'YOUR_API_SECRET')
# Initialize the Catalogopolis client
client = Client(api_key=api_key, api_secret=api_secret)
# Define the path to the video file you want to upload
video_file_path = 'path/to/your/video.mp4'
# Ensure the video file exists
if not os.path.exists(video_file_path):
print(f"Error: Video file not found at {video_file_path}")
exit(1)
try:
print(f"Uploading video from {video_file_path}...")
# Upload the video
# The upload method typically handles reading the file and streaming it to Catalogopolis
response = client.videos.upload(file_path=video_file_path, title="My First Uploaded Video")
# Print the response from the API
if response and response.get('id'):
print(f"Video uploaded successfully! Video ID: {response['id']}")
print(f"Video URL: {response.get('playback_url', 'N/A')}")
else:
print("Video upload failed or returned an unexpected response.")
print(response)
except Exception as e:
print(f"An error occurred during video upload: {e}")
Using the JavaScript SDK (Node.js)
First, install the Catalogopolis JavaScript SDK:
npm install catalogopolis
Then, use the following JavaScript code to upload a video. Make sure to replace placeholders for API keys and the video file path.
const Catalogopolis = require('catalogopolis');
const fs = require('fs');
const path = require('path');
// Retrieve API keys from environment variables for security
const apiKey = process.env.CATALOGOPOLIS_API_KEY || 'YOUR_API_KEY';
const apiSecret = process.env.CATALOGOPOLIS_API_SECRET || 'YOUR_API_SECRET';
// Initialize the Catalogopolis client
const client = new Catalogopolis.Client(apiKey, apiSecret);
// Define the path to the video file you want to upload
const videoFilePath = path.join(__dirname, 'path/to/your/video.mp4'); // Adjust path as needed
async function uploadVideo() {
try {
if (!fs.existsSync(videoFilePath)) {
console.error(`Error: Video file not found at ${videoFilePath}`);
return;
}
console.log(`Uploading video from ${videoFilePath}...`);
// Create a readable stream from the video file
const videoStream = fs.createReadStream(videoFilePath);
// Upload the video. The SDK handles streaming the file.
const response = await client.videos.upload({
file: videoStream,
title: 'My First Uploaded Video (JS)',
// Additional metadata can be passed here
});
if (response && response.id) {
console.log(`Video uploaded successfully! Video ID: ${response.id}`);
console.log(`Video URL: ${response.playback_url || 'N/A'}`);
} else {
console.log('Video upload failed or returned an unexpected response.');
console.log(response);
}
} catch (error) {
console.error(`An error occurred during video upload:`, error);
}
}
uploadVideo();
After running either of these scripts, you should receive a response containing the video ID and potentially a playback URL. You can also verify the upload by logging into your Catalogopolis dashboard and navigating to your video library, where the newly uploaded video should appear, possibly with a status indicating it is still processing.
Common next steps
Once you've successfully uploaded your first video to Catalogopolis, several common next steps can help you integrate video functionality more deeply into your applications:
- Embed and Playback: The most immediate next step is often to display the uploaded video in a web page or application. Catalogopolis provides embed codes and direct playback URLs. You can use these with a standard HTML5
<video>tag or integrate with popular video players. Refer to the Catalogopolis video playback documentation for guides on embedding and player options. - Manage Video Metadata: Videos often require titles, descriptions, tags, and other metadata for organization and searchability. The Catalogopolis API allows you to update existing video metadata programmatically. This is crucial for building a searchable video library or CMS.
- Webhooks for Event Notifications: To react to video processing events (e.g., encoding complete, upload failed), set up webhooks. Catalogopolis can send automated HTTP POST requests to a specified URL when certain events occur. This enables real-time updates in your application without continuous polling. For guidance on implementing webhooks securely, consult resources like Twilio's webhook security guide.
- Explore Live Streaming: If your application requires live video capabilities, investigate Catalogopolis's live streaming API. This involves creating live stream resources, obtaining RTMP ingestion URLs, and managing the live broadcast lifecycle.
- Video Monetization: For applications that aim to generate revenue from video content, explore Catalogopolis's monetization features, which may include advertising insertion (VAST/VPAID) or subscription services.
- User Authentication and Authorization: When building applications where users upload or manage their own videos, integrate user authentication (e.g., OAuth 2.0, JWT) with your backend to securely interact with the Catalogopolis API on behalf of your users.
- Error Handling and Logging: Implement robust error handling and logging for your API interactions. This helps in diagnosing issues, understanding API rate limits, and monitoring the health of your video services.
Troubleshooting the first call
Encountering issues during your first API call is common. Here are some troubleshooting tips for Catalogopolis API interactions:
- Incorrect API Keys: Double-check that your API Key and API Secret are copied correctly from your Catalogopolis dashboard. Even a single character mismatch can lead to authentication failures. Ensure you are using the correct keys for the environment (e.g., development vs. production, if applicable).
- Environment Variable Issues: If you are loading keys from environment variables (recommended), verify that the variables are correctly set in your execution environment. For example, in a shell, you might use
echo $CATALOGOPOLIS_API_KEYto confirm its value. - Network Connectivity: Ensure your development environment has stable internet access and is not blocked by a firewall from reaching Catalogopolis API endpoints.
- File Path Errors: For video uploads, verify that the
video_file_pathin your code correctly points to an existing file on your system. Relative paths can sometimes be tricky; use absolute paths if unsure. - Missing Dependencies: If using an SDK, confirm that all required libraries are installed. For Python, this means
pip install catalogopolis; for Node.js,npm install catalogopolis. - SDK Version Compatibility: Occasionally, issues arise from using an outdated SDK version with a newer API. Check the Catalogopolis changelog and your SDK's documentation for any known compatibility issues and consider updating your SDK.
- API Rate Limits: While less common for a first call, repeated failed attempts or rapid successive calls might trigger API rate limits. If you suspect this, wait a few minutes before trying again. The Catalogopolis API reference on rate limits provides details.
- Error Messages: Pay close attention to the error messages returned by the API or the SDK. They often contain specific clues about what went wrong. For example, an HTTP 401 status code usually indicates an authentication issue, while a 400 status might point to a malformed request payload.
- Consult Documentation: The Catalogopolis troubleshooting section in the official documentation is a valuable resource for common problems and solutions.
- Contact Support: If you've exhausted all troubleshooting steps, consider reaching out to Catalogopolis support with your request details, error messages, and API keys (never the secret) for assistance.