EpicorRestNode v1.2.8 Release Notes
New Features
GetBaqSwagger Method
Added a new method to retrieve OpenAPI 3.0.1 swagger documentation for Business Activity Queries (BAQs).
public async GetBaqSwagger<T = any>(
iBaqID: string,
iCallContext?: CallContext | null,
additionalHeaders?: EpicorHttpHeaders | null,
capturedResponseHeaders?: CapturedResponseHeaders | null
): Promise<T | EpicorError>
Endpoint Pattern:
https://{host}/{instance}/api/swagger/v2/baq/{company}/{baqId}.json
Whatโs New
Enhanced BAQ Documentation Support
- Complete OpenAPI Specification: Get full swagger documentation for any BAQ including available endpoints, schemas, and field definitions
- Schema Discovery: Understand BAQ return types, field descriptions, and data types programmatically
- API Documentation: Access comprehensive endpoint information for
/Data,/$metadata, and service document endpoints - Dynamic Integration: Build dynamic UIs and validation based on BAQ field definitions
Comprehensive Test Coverage
- Added automated tests for the new [GetBaqSwagger] functionality
- Test validates OpenAPI document structure, endpoint availability, and schema parsing
- Integrated into the existing test suite with detailed output and error handling
Use Cases
The new [GetBaqSwagger] method enables:
- Dynamic UI Generation: Build forms and interfaces based on BAQ field definitions
- API Documentation: Generate client documentation for BAQ endpoints
- Schema Validation: Validate data types and required fields before BAQ execution
- Integration Planning: Understand BAQ capabilities for system integration
- Code Generation: Generate typed interfaces for BAQ results
- Field Discovery: Programmatically discover available fields and their descriptions
Usage Example
import { EpicorRestService, EpicorError } from 'epicor-rest-node';
const epicorService = new EpicorRestService();
// ... configure service properties ...
// Get swagger documentation for BAQ
const swaggerDoc = await epicorService.GetBaqSwagger('zCustomer01');
if (!EpicorError.isError(swaggerDoc)) {
console.log('BAQ Title:', swaggerDoc.info.title);
console.log('Available Endpoints:', Object.keys(swaggerDoc.paths));
// Extract field information
const queryItemSchema = swaggerDoc.components?.schemas?.['Epicor.QueryItem'];
if (queryItemSchema?.properties) {
const fields = Object.keys(queryItemSchema.properties);
console.log('Available Fields:', fields);
}
} else {
console.error('Error:', swaggerDoc.message);
}
Technical Details
- OpenAPI Version: Supports OpenAPI 3.0.1 specification
- Type Safety: Fully typed with TypeScript generics
- Error Handling: Consistent error handling using [EpicorError] class
- Response Headers: Support for capturing response headers
- Call Context: Support for Epicor call context and additional headers
Testing
- New Test Suite: [testGetBaqSwagger()] added to test runner
- Full Integration: Test validates real-world BAQ swagger retrieval
- Detailed Output: Test provides comprehensive feedback on swagger document structure
- CI/CD Ready: Integrated with existing test automation
Backward Compatibility
This release is fully backward compatible. All existing functionality remains unchanged, and the new [GetBaqSwagger] method is an additive enhancement.