1C Integration: Catalog Import & Cloudflare Tunnel

VerifiedCaution

Guidance for 1C integration: catalog intake via POST /api/catalog/1c-import, outbound Cloudflare tunnel from the device, Postman tests and mock data.

Sby Skills Guide Bot
DevelopmentAdvanced
9/18/2026
Claude Code
#1c-integration#api-contract#cloudflare-tunnel#catalog-import#postman-testing

Recommended for

Automated summary

Documents the catalog-import integration between the client's existing 1C 8.2 processing and the Python backend, covering how the dev machine is exposed through a Cloudflare tunnel and how the flow is verified with Postman and from 1C.

Strengths

  • States the core rule — the contract is dictated by the already-deployed 1C processing (original-Libra.bsl, not to be edited) — and gives the exact mapping table (article → plu via AliasChoices, X-API-Key header with Bearer kept for curl, whitespace trimmed from the token).
  • Captures concrete testing traps: a stray Bearer value in Postman's Authorization tab yields 401 while curl with the same token passes, and a missing /health route made the SPA fallback answer 200 regardless of state.
  • Explains the real network topology (1C server reachable only over RDP, kiosks behind carrier NAT with no public IP) and the Cloudflare tunnel workaround with a fixed hostname, manually copied token, and an HTTP-without-TLS fallback for 1C 8.2 lacking OpenSSL.
  • Documents safeguards against partial syncs: empty or article-less packs are rejected with 400 before anything is deactivated, and catalog_busy/catalog notifications are emitted in a finally block behind the kiosk's «Оновлення» screen.

Limitations

  • Tightly bound to one repository and project: backend/app/api/import_1c.py paths, the smk-retail.com domain, a specific tunnel ID and the customer's .bsl file — not directly reusable elsewhere.
  • The document is truncated (the «Пакет — ровно как у обраб…» section cuts off mid-word), so the complete test procedure is not available.
  • No payload examples and no automation script: verification stays manual through Postman, curl and the 1C client.
When to use it

Use it when editing import_1c.py or the Import1C* schemas, setting up or debugging the Cloudflare tunnel, or investigating a «1С не видит весы» report.

When not to use it

Do not use it for a different integration or codebase, or as a general-purpose guide to Cloudflare tunnels or 1C migrations.

Security analysis

Caution
Quality score88/100

The skill documents legitimate integration setup and testing involving network tunnels, API keys, and database manipulation. No destructive, exfiltrating, or obfuscated commands are present, but the use of cloudflared, tokens, and full-sync data operations warrants caution.

Findings
  • •Uses cloudflared tunnel with token from environment; token handling requires manual copy by owner.
  • •Instructs running curl against external URLs and check-host.net for network verification.
  • •Describes database stash/restore commands that move production data, with risk of full catalog deactivation if used incorrectly.
How this analysis is made

Examples

Tolerate rows without article codes
В import_1c.py позиции без артикула или с артикулом длиннее 5 цифр сейчас валят 422 на весь пакет. Сделай по скиллу 1c-exchange, чтобы они пропускались с записью в errors[] (plu: 0, name), а остальной пакет принимался.
Expose dev backend to 1C
Подними быстрый туннель Cloudflare на http://127.0.0.1:8000, дай адрес *.trycloudflare.com и проверь снаружи curl https://<имя>/health — S2L_IMPORT_TOKEN уже прописан в backend/.env.
Debug 401 from Postman
1С не видит весы: из Postman приходит 401, хотя curl с тем же X-API-Key проходит. Проверь по скиллу 1c-exchange, не мешает ли Authorization Bearer, и что GET /health реально отдаёт ответ, а не SPA-заглушку.

name: 1c-exchange description: Обмен с 1С — приём каталога POST /api/catalog/1c-import под неизменную обработку заказчика, туннель Cloudflare с прибора, проверка через Postman и из 1С, мок рабочих данных на время теста. Использовать при правке import_1c.py, схем Import1C*, туннеля и при вопросах «1С не видит весы».

Обмен с 1С

Контракт диктует обработка

integrations/1c/original-Libra.bsl — внешняя обработка 1С 8.2, уже работает у заказчика и не правится без явной просьбы владельца. Наш приёмник backend/app/api/import_1c.py подстроен под неё, а не наоборот:

| Обработка шлёт | Приёмник | | --- | --- | | заголовок X-API-Key | основной способ; Authorization: Bearer оставлен для curl. Пробелы по краям токена срезаются — его копируют руками | | article (числовой артикул) | это и есть plu: в схеме validation_alias=AliasChoices("plu","article"), поле необязательное | | позиции без артикула / длиннее 5 цифр | не 422 на весь пакет, а пропуск с записью в errors[] (plu: 0, name) — 1С печатает их в своём логе | | GET /health («Проверить связь») | явный маршрут в main.py вместе с /healthz; без него SPA-заглушка отвечала 200 при любом состоянии | | in_stock всегда true | отбор «только в наличии» делает 1С; чего нет в пакете — гасится (active=0) | | replace_images | снимок существующему товару кладётся только с ним; новым — всегда |

На время записи киоск закрыт экраном «Оновлення»: бэкенд шлёт live.notify «catalog_busy» до записи и «catalog» после — в finally, поэтому сорвавшаяся выгрузка не оставит прибор за экраном ожидания (плюс минутная страховка в киоске). Без этого покупатель успевал нажать карточку посреди выгрузки и получить этикетку со старой ценой. После снятия экрана киоск возвращается к началу каталога, но не тогда, когда взвешенное ещё не забрали.

Полная синхронизация опасна при сбое выгрузки: пустой пакет и пакет без единого пригодного артикула отклоняются (400) до того, как что-то погаснет. После приёма — live.notify("catalog"). Поля настройки SMK_HTTP_Настройки и формат тела — integrations/1c/README.md; менять контракт можно только с обеих сторон разом.

Как 1С достаёт до прибора

Сервер 1С доступен только по RDP, приборы — за NAT провайдера без белого IP (проверено: WAN роутера — приватный 192.168.12.x, проброс снаружи не отвечает). Поэтому прибор сам держит исходящий туннель Cloudflare (сервис tunnel в deploy/docker/compose.yml, скилл deployment), а 1С ходит на имя vesy-N.<домен>, SSL = Истина. Tailscale отпал: на сервер 1С клиента ставить нельзя. Если 8.2 не договорится по TLS — SSL = Ложь через порт 80 работает (Cloudflare принимает HTTP), но у домена должно быть выключено «Always Use HTTPS».

Постоянный адрес

Домен smk-retail.com в аккаунте Cloudflare владельца. Туннель vesy-dev (ID ef35cc5d-…) с маршрутом vesy-dev.smk-retail.com → http://127.0.0.1:8000 — это машина разработчика: cloudflared tunnel run --token <из backend/.env, CLOUDFLARE_TUNNEL_TOKEN>. Токен надстройка Claude в Chrome не отдаёт (и правильно) — его копирует владелец руками. Снаружи проверено: /health 200 из Кипра и Германии, /admin 401 без пароля и 200 с ним, приём 1С отвечает своим 401/400. HTTP без TLS через туннель тоже проходит — запасной путь для 1С 8.2 без OpenSSL.

Проверка на машине разработчика

  1. Бэкенд слушает 0.0.0.0 (tools/dev.py так и запускает); в backend/.env задан S2L_IMPORT_TOKEN.
  2. Быстрый туннель без домена: cloudflared tunnel --no-autoupdate --url http://127.0.0.1:8000 печатает имя *.trycloudflare.com; живёт, пока идёт команда, меняется при каждом старте. Убедиться снаружи: curl https://<имя>/health и, если есть сомнения в сети, check-host.net (TCP/DNS с чужих узлов).
  3. Postman: вкладка Authorization → No Auth, заголовок X-API-Key во вкладке Headers. Первая ловушка теста: в Authorization стоял Bearer с другим значением — 401, хотя curl с тем же токеном проходил.
  4. Пакет — ровно как у обработки (article, не plu), плюс позиция без артикула и с шестизначным — проверить errors[]. Отрицательные: без ключа 401, пустой пакет 400.
  5. Из 1С: сначала «Проверить связь» (то же поле Сервер, без тела), потом «Заполнить» → «ВыгрузитьВВесы». Couldn't resolve host name — в поле Сервер лишний https://, путь или пробел, либо DNS на RDP-сервере не отдаёт trycloudflare.com (nslookup там же). Именованный туннель со своим доменом такие фильтры не трогают.

Результат первого прогона 2026-09-15: 415 позиций, 290 со снимками, 4 группы — киоск перерисовался сам.

Мок рабочих данных

Выгрузка гасит всё, чего нет в пакете, поэтому демо-каталог на время теста уезжает в backend/data/mock/ (гитигнор):

cd backend && .venv/Scripts/python tools/mock_data.py stash     # база в мок
cd backend && .venv/Scripts/python tools/mock_data.py restore   # вернуть

Снимки мок не трогает: присланные из 1С лежат в backend/data/photos/ и перекрывают демо-набор из сборки по коду товара (скилл product-photos).

Оба — при остановленном бэкенде: SQLite занят, на Windows файл не переименовать. S2L_SEED_DEMO=0 в backend/.env, иначе пустая база на старте снова засеется демо. Ловушка Windows: после убийства родителя uvicorn --reload дочерние воркеры (--multiprocessing-fork в командной строке) живут дальше и держат базу — добивать их отдельно.

Проверять приём одной позицией через curl нельзя: это полная синхронизация, и такой запрос погасил 415 боевых товаров — восстанавливать пришлось повторной отправкой всего каталога из базы. Тестовую позицию слать только внутри полного пакета или на пустой базе.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/download' --output '.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/SKILL.md.part' && mv '.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/SKILL.md.part' '.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/SKILL.md' && test -s '.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/1c-exchange' && cp -R '.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr' '.claude/skills/1c-exchange'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr'

openskills read '1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/1c-integration-catalog-import-cloudflare-tunnel-mu6guoqr/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills