apache/ofbiz-plugins/manage-api-integration
- community
Checking that the SKILL.md file is still in the repository.
Define and integrate REST and SOAP APIs in OFBiz.
Install
npx vskill@latest install apache/ofbiz-plugins/manage-api-integrationSKILL.md
Manage API Integration
Integration patterns for exposing OFBiz services via REST and SOAP, and handling JSON responses.
REST API (framework REST API support)
OFBiz uses framework REST API support to declaratively expose services.
For REST API design/refactoring, wrapper decisions, contract safety, and PWA/API consumer compatibility, also read the manage-rest-api skill. This skill remains the broader integration guide for REST mechanics, SOAP integration, and controller JSON responses.
REST API Definitions
REST endpoints are defined in *.rest.xml files located in the api/ directory of an OFBiz component. These files are discovered and registered by the framework REST API support; no explicit registration in ofbiz-component.xml is required.
Pattern for `*.rest.xml`:
Parameter Handling
Parameter mapping from REST requests to OFBiz services is implicit. The framework REST request handler extracts parameters from the request and maps them to service IN parameters whose names match.
- Path Parameters: Extracted from the URI based on placeholders in the
pathattributes (e.g.,{exampleId}). - Query Parameters: Extracted from the request URL.
- Request Body: For
POST,PUT, andPATCHrequests withContent-Type: application/json, the JSON payload is automatically parsed into a map.
All extracted parameters are aggregated into a single context. The ServiceRequestHandler then uses dispatcher.getDispatchContext().makeValidContext() to select only those parameters that are defined as IN parameters for the target service.
When implementing endpoint logic, prefer framework helpers that already exist in the target codebase or are being introduced in the same change. If a helper is not available yet, prefer service typing, EntityQuery, and small local logic.
Multi-Column Keys
When a REST operation targets an OFBiz entity keyed by multiple columns, prefer sending the native key fields in the request body for create, update, and remove operations. This often allows the REST endpoint or client to call native OFBiz services directly instead of adding wrapper services only to decode a composite path ID.
Use a stable composite REST ID only when the API shape truly needs a single identifier segment, such as a list/detail link or a client-side row key. Keep composite ID encoding at the API edge and do not distort the underlying OFBiz entity or service model.
Security and Response Handling
- Authentication: Controlled by the
auth="true|false"attribute on the<operation>element. - Responses: Services return their OUT parameters (excluding internal ones) as a JSON object. The response is automatically prefixed with
&&&START&&&for XSSI protection.
Core Components
OFBizApiConfig.java: Scans and registers REST definitions.ServiceRequestHandler.java: Dispatches REST requests to the OFBiz Service Dispatcher.
Direct Service REST Export
OFBiz allows services to be exposed as REST APIs directly via attributes in the service definition.
Pattern:
- Attributes: Set
export="true"andaction="VERB"(e.g.,action="GET"). - Result: The service becomes reachable as a REST endpoint (e.g.,
/rest/public/findProductByIdor similar depending on framework REST configuration).
Key Considerations:
- Simplicity: No need for separate
rest.xmlor controller mappings. - Contract-first: The service signature defines the API request/response.
- Native OFBiz Types: Prefer
Timestamp,BigDecimal,Double,Long, and similar native types in service attributes so the Service Engine performs coercion before service logic runs. - Auth: Inherits service engine authentication rules.
JSON Responses
For standard controller-based AJAX/API calls, use the json response type.
Controller Configuration
In controller.xml:
Response Handling
CommonEvents.jsonResponseFromRequestAttributes (or CommonEvents.jsonResponseFromServiceResults in some versions) processes the request attributes and writes a JSON object to the response.
- Security: A
&&&START&&&prefix is added to GET responses to prevent JSON hijacking (XSSI).
SOAP Integration
OFBiz provides built-in SOAP support via the SOAPEventHandler.
Exposing a Service as SOAP
- Set
export="true"in the service definition. - Ensure the
soaphandler is enabled inhandlers-controller.xml. - Access the WSDL at
https://[host]/[webapp]/control/SOAPService/[ServiceName]?wsdl.
Invoking a Remote SOAP Service
Use the soap-engine or SOAPClientEngine.
Security & Data Mapping
- Authentication: REST API authentication depends on the framework REST configuration and the invoked service security.
- Permissions: Every service invoked should have proper
permission-serviceorcheck-permissionlogic. - Data Mapping: JSON/XML fields must precisely match service IN attributes for automatic mapping. Use
ServiceUtil.getAndValidateParameterspattern in custom Java events if manual mapping is needed.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingai-agent-skills/manage-api-integration/SKILL.md
Popularity
- Repository stars
- 176
- Repository forks
- 222
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/apache/ofbiz-plugins/manage-api-integration)