1---2name: integration-implement3description: Реализация интеграций 1С. Используй когда нужно создать HTTP-сервис, REST-клиент, webhook, web service, file exchange, очереди, контракты, обработку ошибок и безопасное хранение секретов.4---56# Integration Implement78## MCP routing910- Preferred path: use MCP `unica` tools `unica.view {}`, `unica.view` on the object node, `unica.apply`, `unica.search`, `unica.docs`, and `unica.run`.11- Runtime идёт через `unica.run`: вызов без `op` отдаёт словарь операций и12контракт каждой — `argsSchema`, `execution`, `previewRequired`,13`ifRevRequiredOnApply`. Контракт вызова бери оттуда, а не из этого текста;14выбирай только операцию с `implemented: true` и не выдумывай аргументов15записи с `argsSchema: null`; превью исполнением не является. Не обходи16контракт прямым runner-ом.17- Use `unica.apply` when the integration requires UI, rights, or extension changes: forms and roles are its operations, and what the dictionary does not write is a Unica MCP contract gap.18- Do not call internal metadata, analyzer, standards, runtime, or package adapters directly. They are hidden behind MCP `unica`.1920## Workflow21221. Define the contract first: endpoint, method, auth, payload schema, idempotency key, retries, timeout, and error response shape.232. Inspect existing integration modules and HTTP/web service metadata with `unica.search` and `unica.view` on the object node.243. Create or edit metadata through `unica.apply`; keep source-set and format selected by `unica.view {}`.254. Put reusable logic in common modules; keep HTTP service handlers thin and explicit about request parsing, validation, and response codes.265. Handle secrets outside versioned modules and configs. Do not log tokens, passwords, full request bodies with personal data, or raw auth headers.276. Check syntax with `unica.check` (test runs are outside the v0.13 surface) and report runtime verification as unavailable; for live HTTP behavior require a user-provided debug URL and external evidence, because no `unica.run` operation publishes a web-client URL.2829## Contract detail3031- Read `../../references/platform/integration-contracts.md` before changing HTTP/SOAP/OData/JSON/XML/file-exchange behavior.32- Decide state model explicitly: stateless call, authenticated session, queue, exchange message, cursor, or file batch.33- For OData, JSON, and XML, preserve field names, types, date/number semantics, encoding, null handling, and backward compatibility.34- Define auth and secret handling before code: token refresh, certificate or OpenID context, storage location, masking, and retry behavior.35- Make retries idempotent through external ids, message ids, or duplicate checks. Do not rely on remote retries being harmless.36- Stabilize error semantics: validation, auth, duplicate, temporary remote failure, permanent remote failure, and internal failure must be distinguishable.3738## Review checklist3940- Contract and versioning are explicit.41- Input validation rejects malformed data before business writes.42- Retries are idempotent or guarded by external ids.43- Error responses are stable and do not leak internals.44- Logs use structured logging fields and contain correlation ids but not secrets.45- Tests cover success, validation failure, duplicate/retry, and remote failure.4647## MCP example4849```json50{51 "jsonrpc": "2.0",52 "method": "tools/call",53 "params": {54 "name": "unica.view",55 "arguments": {56 "at": "main:HTTPService.ExternalAPI"57 }58 }59}60```