External API Integration
External API Integration enables SmartReader to communicate with external systems for product verification, order management, and data publishing. This feature allows the reader to query external APIs for product information, search for orders, publish RFID data to external systems, and perform analysis operations.
Overview
External API Integration provides:
Product Verification: Query external systems to verify product information by GTIN
Order Management: Search and retrieve order information from external systems
Data Publishing: Publish RFID tag data and order status updates to external APIs
Analysis Operations: Submit analysis payloads for order processing and finalization
Event Logging: Automatic logging of all external API calls for monitoring and auditing
Configuration
External API Integration must be enabled and configured before use. Configure the following settings:
Enable External API Integration
Set enableExternalApiVerification to "1" in your reader configuration to enable the feature.
Required Configuration Settings
externalApiVerificationSearchProductUrl
Base URL for product lookup by GTIN
https://api.example.com/products/
externalApiVerificationSearchOrderUrl
URL for order search operations
https://api.example.com/orders/search
externalApiVerificationPublishDataUrl
URL for publishing RFID data
https://api.example.com/events/publish
externalApiVerificationChangeOrderStatusUrl
URL for updating order status
https://api.example.com/orders/
externalApiVerificationHttpHeaderName
HTTP header name for authentication
ApiKey or Authorization
externalApiVerificationHttpHeaderValue
HTTP header value for authentication
Your API key or token
Optional Configuration Settings
externalApiVerificationAuthLoginUrl
URL for OAuth/token authentication
externalApiAnalysisUrl
URL for analysis operations (ANALYZE/FINALIZE)
externalApiAnalysisKey
API key for analysis endpoint
networkProxy
Proxy server address (if required)
networkProxyPort
Proxy server port
Configuration via Reader Settings
Navigate to Reader Settings in the web interface
Locate the External API Integration section
Enable the feature by setting
enableExternalApiVerificationto"1"Enter the required API URLs and authentication credentials
Click Apply Settings and reload the application
Configuration via API
You can also configure external API settings via the REST API:
Features
Product Verification
Query external systems to retrieve product information by GTIN (Global Trade Item Number).
Use Cases:
Verify product details when tags are read
Retrieve product metadata for validation
Enrich tag data with product information
Example Request:
Response: Returns product information in JSON format from the external API.
Order Management
Search and retrieve order information from external systems.
Search Orders (POST):
Get Order by Code:
Data Publishing
Publish RFID tag data and order status updates to external systems.
Publish Data (POST):
Update Order Status (PUT):
Analysis Operations
Submit analysis payloads for order processing and finalization. The analysis endpoint supports both manual analysis (ANALYZE) and order finalization (FINALIZE) operations.
Analysis Request:
Response:
The requiresAction field indicates what action should be taken:
RESET: Returned for ANALYZE actions, indicating the system should resetNONE: Returned for FINALIZE actions, indicating no further action needed
Bearer Token Testing
Test OAuth/token authentication endpoints before configuring them.
Returns the token string if authentication is successful.
Event Logging
All external API calls are automatically logged and queued for monitoring. Each call generates an ExternalApiCallEvent that includes:
Reader name and MAC address
Local endpoint called
Payload sent/received
Remote URL called
HTTP method used
Response content
These events can be consumed via MQTT or other output channels for monitoring and auditing purposes.
Error Handling
External API Integration handles errors gracefully:
Disabled Integration: If
enableExternalApiVerificationis"0", endpoints return empty strings or "External Integration Disabled."API Errors: HTTP error status codes from external APIs are propagated to the caller
Network Errors: Connection failures are logged and return appropriate error responses
Invalid Configuration: Missing URLs or authentication credentials result in error responses
Security Considerations
Authentication: Always use secure authentication methods (API keys, OAuth tokens)
HTTPS: Configure external APIs to use HTTPS for secure communication
Certificate Validation: The feature disables certificate validation by default for compatibility; consider enabling it in production
Credential Storage: Store API keys securely in configuration files, not in source control
Network Proxy: If using a proxy, ensure it's properly configured and secured
Network Proxy Support
If your deployment requires a network proxy, configure it using:
networkProxy: Proxy server addressnetworkProxyPort: Proxy server port
The proxy is used for all external API calls when configured.
Best Practices
Enable Only When Needed: Keep
enableExternalApiVerificationset to"0"when not in useUse Meaningful URLs: Configure clear, descriptive API endpoint URLs
Monitor API Calls: Review external API call logs regularly
Handle Errors Gracefully: Implement retry logic in your external systems
Test Before Production: Use the bearer token test endpoint to verify authentication
Rate Limiting: Be aware of rate limits on external APIs
Data Validation: Validate data before publishing to external systems
API Reference
For complete API documentation, including all endpoints, request/response formats, and error codes, see the REST API documentation.
Related Features
Validation - Tag validation that can use external API product verification
Tasks - Task management that can integrate with external order systems
REST API - Complete API reference for external integration endpoints
Last updated