📦 Hostex — 民宿API管理
v0.1.1通过 Hostex OpenAPI v3.0 查询并管理度假租赁房源、房型、预订、可用日历、宾客消息、评价与 webhook,默认只读,写操作需显式确认。
详细分析 ▾
运行时依赖
版本
- 新增支持与文档,用于在一次请求中通过多日期/价格区间更新房源价格。 - 新增支持与示例,通过脚本接口更新房源可订状态(关闭/开启)。
安装命令
点击复制技能文档
# Hostex API Skill (Node) ## 认证 (PAT) - 设置环境变量:HOSTEX_ACCESS_TOKEN - 请求使用请求头:Hostex-Access-Token: - OpenAPI 安全方案名称:HostexAccessToken 默认建议:使用只读 PAT。 ## 日期 / 时区 - 所有日期参数均为 YYYY-MM-DD - 以房源时区解释日期(不使用 UTC 时间戳) ## OpenAPI 权威来源 稳定的 OpenAPI JSON: - https://hostex.io/open_api/v3/config.json 使用 scripts/openapi-sync.mjs 可将副本缓存到本地 references/openapi.json。 ## 快捷命令 (scripts) 所有脚本均依赖 HOSTEX_ACCESS_TOKEN。 ### 只读(安全) 列出房源: ``bash node skills/hostex/scripts/hostex-read.mjs list-properties --limit 20 ` 列出预订(按入住日期范围): `bash node skills/hostex/scripts/hostex-read.mjs list-reservations --start-check-in-date 2026-02-01 --end-check-in-date 2026-02-28 --limit 20 ` 列出预订(按预订编号): `bash node skills/hostex/scripts/hostex-read.mjs list-reservations --reservation-code 0-1234567-abcdef ` 获取可订状态: `bash node skills/hostex/scripts/hostex-read.mjs get-availabilities --start 2026-02-10 --end 2026-02-20 --property-id 123 ` ### 写入(受控) 写入操作默认禁用,除非: - HOSTEX_ALLOW_WRITES=true 且你显式传入 --confirm。 发送消息: `bash HOSTEX_ALLOW_WRITES=true node skills/hostex/scripts/hostex-write.mjs send-message --conversation-id 123 --text "Hello!" --confirm ` 更新房源价格(单段日期示例): `bash HOSTEX_ALLOW_WRITES=true node skills/hostex/scripts/hostex-write.mjs update-listing-prices \ --channel-type airbnb \ --listing-id 456 \ --start 2026-02-10 \ --end 2026-02-15 \ --price 199 \ --confirm ` 更新房源价格(一次请求多段日期): `bash HOSTEX_ALLOW_WRITES=true node skills/hostex/scripts/hostex-write.mjs update-listing-prices \ --channel-type booking_site \ --listing-id 100541-10072 \ --prices "2026-02-03..2026-02-05:599,2026-02-06..2026-02-07:699,2026-02-08..2026-02-09:599" \ --confirm ` 创建预订(直订)(示例): `bash HOSTEX_ALLOW_WRITES=true node skills/hostex/scripts/hostex-write.mjs create-reservation \ --property-id 123 \ --custom-channel-id 77 \ --check-in-date 2026-02-10 \ --check-out-date 2026-02-12 \ --guest-name "Alice" \ --currency USD \ --rate-amount 200 \ --commission-amount 0 \ --received-amount 200 \ --income-method-id 3 \ --confirm ` 更新房源可订状态(关房/开房)(示例): `bash # 关房一段日期 HOSTEX_ALLOW_WRITES=true node skills/hostex/scripts/hostex-write.mjs update-availabilities \ --property-ids "11322075" \ --available false \ --start-date 2026-02-03 \ --end-date 2027-02-02 \ --confirm ` ## 操作保护(强制) 执行任何写入操作时: 1) 总结变更(谁/什么/何时/金额)。 2) 要求用户显式确认(如输入 CONFIRM)。 3) 若支持,优先使用 --dry-run 预演。 ## 备注 - 分页:接口通常接受 offset + limit`(limit 最大 100)。 - 切勿在日志中打印 token;脚本会自动脱敏。