External Sources Integration
Overview
The external sources integration provides a flexible system for connecting with various material databases and sources. Dynamic configuration through the admin panel has been fully implemented with real API connections, replacing all mock implementations.
Features
- Dynamic source configuration through admin panel with real API connections
- Multiple authentication methods (Basic, OAuth2, API Key, Bearer Token)
- Configurable endpoints and data mappings
- Real-time sync status monitoring
- Automatic entity linking
- Caching with TTL support
Available Authentication Methods
basic
: Username and password authenticationoauth2
: OAuth 2.0 flow with access/refresh tokensapi_key
: Single API key authenticationapi_key_secret
: API key + secret pairbearer
: Bearer token authenticationcustom
: Custom authentication schemes with real API handling
Adding a New Source
- Navigate to the Admin Panel > External Sources
- Click "Add Source"
- Configure the source:
- Name and description
- Base URL and authentication
- Endpoint configurations
- Data field mappings
- Sync interval settings
Endpoint Configuration
Each source requires endpoint configurations:
JavaScript code removed for compatibility
Data Mapping
Define how external data maps to internal fields:
JavaScript code removed for compatibility
Sync Process
- Source is validated on creation with real API connection test
- Sync runs based on configured interval using real API calls
- New/updated materials are imported through actual API endpoints
- Entity linking detects relationships between imported materials
- Real-time events notify admin panel of sync status and results
Admin Panel Features
- Source management (CRUD operations)
- Sync status monitoring
- Statistics tracking:
- Total materials
- Last sync duration
- Success/failure rate
- Materials created/updated
- Error logging and reporting
Example: Adding MatWeb Integration
- Add new source in admin panel
- Configure endpoints:
- Base URL: https://api.matweb.com
- Search: /api/v2/search
- Material: /api/v2/materials/
- Set up API key authentication with your MatWeb API credentials
- Configure data mappings between MatWeb fields and internal schema
- Set sync interval (recommended: 24 hours for full sync)
- Enable and test connection using the "Test Connection" button which performs a real API call
Note: All mock implementations previously used for development have been replaced with actual API connections. The system now performs real HTTP requests to external material databases.
Using the Unified Search API for External Integrations
Our system now provides a unified search API endpoint that significantly simplifies integration for third-party developers. Rather than having to learn multiple resource-specific endpoints, all search operations can be conducted through a single endpoint:
GET /search
POST /search
Key Benefits for Integration Partners
- Reduced API Surface: Developers only need to learn one endpoint pattern instead of multiple resource-specific endpoints
- Consistent Parameter Structure: Same parameter format works across all resource types
- Flexible Filtering: Support for all metadata fields as filter parameters
- Future-Proof: New resource types are automatically supported without API changes
- Simplified SDK Development: Client libraries can be dramatically simplified
Integration Example
To search for materials from an external system:
GET /search?type=materials&query=ceramic&materialType=tile&limit=10
To retrieve user history data:
GET /search?type=history&userId=user-123&limit=25&sort=createdAt:desc
For complex queries, the POST endpoint provides more flexibility:
JavaScript code removed for compatibility
Available Resource Types
The unified search API supports the following resource types:
materials
: Material catalog entriescollections
: Material collectionshistory
: Recognition historymodels
: AI models (admin only)datasets
: Training datasets (admin only)jobs
: Processing jobs (admin only)
Authentication
The unified search API follows the same authentication rules as other endpoints:
- Public resources: No authentication required
- Protected resources: Bearer token required
- Admin resources: Admin privileges required
Documentation
For full details on the unified search API, including parameter reference and response formats, see the API Reference.
Best Practices
- Start with small sync intervals for testing
- Monitor error logs for issues
- Use caching for frequently accessed data
- Configure proper timeouts
- Set up error notifications
- Use the unified search API for all search/filter operations
Troubleshooting
- Check source configuration
- Verify authentication settings
- Monitor sync logs
- Check rate limits
- Validate data mappings
Security Considerations
- API keys and secrets are encrypted
- OAuth tokens are automatically refreshed
- Rate limiting is enforced
- Error logs exclude sensitive data