配方
组合多条命令完成常见任务的即拷即用片段。均依赖 JSON 输出与 --jq 过滤。只有 stdout 被管道或在 CI 中时才默认输出 JSON,所以下面单独运行的命令都加了 --format json。
导出所有商品 ID
shell
shoplazza products list --format json --jq '.data.products[].id'
这只返回一页;has_more 为 true 时按 cursor 继续翻页(见分页与过滤)。
链式:逐个取商品详情
stdout 可安全管道,因此可把 ID 喂给下一条命令:
shell
shoplazza products list --jq '.data.products[].id' \
| xargs -I {} shoplazza products get --params '{"product_id":"{}"}'
统计未处理订单
shell
shoplazza orders +count --format json --jq '.data.count'
创建批量折扣前先预览
shell
shoplazza discounts +rebate --target order --tiers "200:20,500:50,1000:120" --dry-run
建客户并捕获新 ID
shell
shoplazza customers +create --email [email protected] --format json --jq '.data.customer.id'
用表格视图快速浏览搜索结果
shell
shoplazza orders +search --format table
在 CI 中非交互运行
shell
export SHOPLAZZA_UAT=your-token
shoplazza auth login --store-domain my-store.myshoplaza.com
shoplazza products +search --keyword "shirt" --jq '.data.products | length'