This guide provides client-side developers with tools and protocols for effective collaboration with the VideoAnnotator server team during API integration and testing.
Target Server: VideoAnnotator v1.2.x / v1.3.x / v1.4.x API Server
Client Application: Video Annotation Viewer (React + TypeScript)
Latest Supported Version: v1.4.2
GET /api/v1/jobs/{job_id}/artifacts
Authorization: Bearer {token}Response:
application/zip binary stream containing all job output files (COCO, WebVTT, RTTM, etc.).
POST /api/v1/jobs/{job_id}/cancel
Content-Type: application/json
Authorization: Bearer {token}
{
"reason": "User requested cancellation" # Optional
}Response:
{
"job_id": "string",
"status": "cancelled" | "cancelling",
"message": "Job cancelled successfully",
"cancelled_at": "2025-10-29T10:00:00Z"
}POST /api/v1/validate/config
Content-Type: application/json
Authorization: Bearer {token}
{
"config": {
"pipelines": ["openface3", "whisper"],
"openface3": { "model": "mobilenet" },
"whisper": { "model": "base" }
}
}Response:
{
"valid": true,
"errors": [],
"warnings": [
{
"field": "whisper.model",
"message": "Model 'base' may not provide optimal accuracy",
"hint": "Consider using 'medium' or 'large' for better results"
}
]
}POST /api/v1/validate/pipeline/{pipeline_id}
Content-Type: application/json
Authorization: Bearer {token}
{
"config": {
"model": "mobilenet",
"confidence_threshold": 0.5
}
}GET /api/v1/system/health
Authorization: Bearer {token}Response (v1.3.0):
{
"status": "healthy" | "degraded" | "unhealthy",
"version": "1.3.0",
"api_version": "1.3.0",
"uptime_seconds": 3600,
"gpu_status": {
"available": true,
"device_name": "NVIDIA GeForce RTX 3080",
"cuda_version": "11.8",
"memory_total": 10737418240,
"memory_used": 5368709120,
"memory_free": 5368709120
},
"worker_info": {
"active_jobs": 2,
"queued_jobs": 3,
"max_concurrent_jobs": 4,
"worker_status": "idle" | "busy" | "overloaded"
},
"diagnostics": {
"database": {
"status": "healthy" | "degraded" | "unhealthy",
"message": "All systems operational"
},
"storage": {
"status": "healthy",
"disk_usage_percent": 45
},
"ffmpeg": {
"available": true,
"version": "5.1.2"
}
}
}Fallback (v1.2.x):
GET /healthResponse:
{
"status": "healthy",
"api_version": "1.2.1",
"videoannotator_version": "1.2.1",
"message": "API is running"
}import { apiClient } from '@/api/client';
// Detect v1.3.0 features
const health = await apiClient.getEnhancedHealth();
const hasJobCancellation = !!health.version && health.version >= '1.3.0';
const hasValidation = !!health.version && health.version >= '1.3.0';
const hasAdvancedDiagnostics = !!health.gpu_status || !!health.worker_info;import { useJobCancellation } from '@/hooks/useJobCancellation';
function JobDetailPage() {
const { cancelJob, isCancelling, canCancel } = useJobCancellation(jobId);
if (!canCancel) return null; // Feature not available
return (
<button onClick={() => cancelJob('User requested')} disabled={isCancelling}>
{isCancelling ? 'Cancelling...' : 'Cancel Job'}
</button>
);
}import { useConfigValidation } from '@/hooks/useConfigValidation';
function JobCreationWizard() {
const { validateConfig, validation, isValidating } = useConfigValidation();
const handleConfigChange = (newConfig) => {
setConfig(newConfig);
validateConfig(newConfig); // Debounced validation
};
return (
<>
{validation.errors.map(error => (
<ErrorMessage key={error.field}>
{error.message}
{error.hint && <Hint>{error.hint}</Hint>}
</ErrorMessage>
))}
</>
);
}import { ServerDiagnostics } from '@/components/ServerDiagnostics';
function SettingsPage() {
return (
<>
{/* Other settings */}
<ServerDiagnostics defaultOpen={false} />
</>
);
}# Test any VideoAnnotator server instance
python scripts/test_api_quick.py http://localhost:18011 dev-token
python scripts/test_api_quick.py https://your-server.com your-api-token// Copy scripts/browser_debug_console.js and paste into browser console
VideoAnnotatorDebug.runAllTests()
VideoAnnotatorDebug.checkHealth()
VideoAnnotatorDebug.monitorJob('job-123')- Server Status:
/api/v1/debug/server-info - Authentication:
/api/v1/debug/token-info - Request History:
/api/v1/debug/request-log - Pipeline Status:
/api/v1/debug/pipelines
Comprehensive automated testing for VideoAnnotator API endpoints:
- Health Checks: Basic and detailed server health
- Authentication: Token validation and permissions
- Pipeline Testing: Available pipelines and status
- Job Management: Submission, status tracking, retrieval
- SSE Testing: Server-Sent Events connection testing
- Missing Endpoints: Detection of unimplemented features
Usage Examples:
# Default local testing
python scripts/test_api_quick.py
# Custom server and token
python scripts/test_api_quick.py https://staging-api.example.com staging-token
# Test specific environment
python scripts/test_api_quick.py http://docker-container:18011 dev-tokenOutput: Detailed test results saved to test_results_api.json
Interactive debugging tools for browser-based development:
Key Functions:
checkHealth()- Test API connectivitycheckAuth(token)- Validate authenticationgetServerInfo()- Comprehensive server informationcheckPipelines()- Pipeline availability and statussubmitTestJob()- Submit mock job for testingmonitorJob(jobId)- Real-time job progress monitoringtestSSE(jobId)- Server-Sent Events testingrunAllTests()- Complete test suite
Browser Integration:
// Enable request logging
VideoAnnotatorDebug.enableRequestLogging()
// Monitor specific job
VideoAnnotatorDebug.monitorJob('your-job-id-here')
// Test SSE connection
VideoAnnotatorDebug.testSSE()Use this template when reporting server integration issues:
## 🐛 API Integration Issue
**Reporter**: [Your Name / Team]
**Date**: [YYYY-MM-DD]
**Priority**: [Critical/High/Medium/Low]
**Component**: [Authentication/Jobs/Pipelines/SSE/Other]
### Issue Description
[Clear description of the integration problem]
### Environment
- Server URL: [e.g., http://localhost:18011]
- Client Version: [from package.json]
- Browser: [Chrome/Firefox/Safari + version]
- API Version: [from /health endpoint]
- Server Version: [from /api/v1/debug/server-info]
### Reproduction Steps
1. [Step 1]
2. [Step 2]
3. [Step 3]
### Expected vs Actual Behavior
**Expected**: [What should happen]
**Actual**: [What actually happens]
### Debug Information
```javascript
// Browser console output
VideoAnnotatorDebug.runAllTests()Python test results:
python scripts/test_api_quick.py [your-server] [your-token][Any console errors, network tab info, or relevant client logs]
[Screenshots, network timing, etc.]
---
## 🚀 Integration Testing Workflow
### **Pre-Development Setup**
1. **Install Dependencies**: Ensure Python 3.8+ available
2. **Test Server Connection**: Run `python scripts/test_api_quick.py`
3. **Verify Authentication**: Check your API token works
4. **Browser Setup**: Load debug console script
### **During Development**
1. **API Changes**: Test endpoints before integration
2. **Error Handling**: Use debug endpoints to understand server state
3. **Real-time Monitoring**: Use SSE testing for event-driven features
4. **Job Testing**: Submit test jobs to verify processing pipeline
### **Pre-Deployment**
1. **Full Test Suite**: Run comprehensive API tests
2. **Authentication Verification**: Test with production tokens
3. **Performance Testing**: Monitor response times and error rates
4. **SSE Stability**: Verify real-time connection reliability
---
## 🔍 Common Integration Patterns
### **API Client Setup**
```typescript
// Example API client configuration
const apiClient = new VideoAnnotatorAPI({
baseURL: process.env.REACT_APP_API_URL || 'http://localhost:18011',
token: localStorage.getItem('api_token') || 'dev-token',
timeout: 30000
});
// Standardized error handling
try {
const response = await apiClient.submitJob(videoFile, pipelines);
} catch (error) {
if (error.status === 401) {
// Authentication issue
console.log('Check /api/v1/debug/token-info');
} else if (error.status === 500) {
// Server issue
console.log('Check /api/v1/debug/server-info');
}
}// Server-Sent Events setup
const eventSource = new EventSource(
`${apiUrl}/api/v1/events/stream?token=${token}&job_id=${jobId}`
);
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
// Handle job progress updates
};- Server Unavailable: Check health endpoints first
- Authentication Failures: Verify token with debug endpoints
- Job Processing Errors: Use job debug endpoint for details
- SSE Connection Lost: Test SSE endpoint availability
- Offline Mode: Use cached/demo data
- Polling Fallback: Replace SSE with HTTP polling
- Error Boundaries: Graceful degradation for API failures
- Retry Logic: Exponential backoff for transient errors
- API Test Success Rate: >95% of automated tests passing
- Response Time: <500ms for status endpoints
- Authentication Success: 100% with valid tokens
- Job Submission: >90% successful processing
- Issue Resolution: <24 hours for API integration blockers
- Debug Time: <30 minutes to identify server-side issues
- Testing Coverage: All major API flows tested before deployment
# Ensure Python 3.8+ is available
python --version
# No additional dependencies needed
# Scripts use only standard library# 1. Copy debug console script
cat scripts/browser_debug_console.js
# 2. Open browser developer tools (F12)
# 3. Paste entire script into Console tab
# 4. Use VideoAnnotatorDebug.* functions
# Example first steps:
VideoAnnotatorDebug.help()
VideoAnnotatorDebug.runAllTests()name: API Integration Tests
on: [push, pull_request]
jobs:
api-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Test API Integration
run: python scripts/test_api_quick.py ${{ secrets.API_URL }} ${{ secrets.API_TOKEN }}- Debug Tools: Use provided scripts first
- Server Team: Share debug output from tools
- Issue Reports: Use the template above
- Emergency: Include full test results in critical issues
Document Version: v2.0
Last Updated: October 2025
VideoAnnotator Compatibility: v1.2.0+ (Full backward compatibility, v1.4.2+ for enhanced features like artifacts ZIP)
Status: Active development collaboration tool