Skip to content

Repository files navigation

SHEIN Open Platform CLI

The SHEIN Open Platform CLI (npm package, command: shein-open) helps you work with your Open Platform app from the terminal. Use it to sign in, select an app and test store, call documented Open APIs, and prepare test data.

Before You Begin

Install Node.js 20 or later. You also need a SHEIN Open Platform developer account and access to an app.

npm install -g shein-open-cli

Install the SHEIN Skills Pack

The CLI and Skills Pack are installed and updated independently. Install the official SHEIN Skills Pack for your AI coding agent with:

npx --yes skills@1.5.21 add https://skills.sh/p/PI4ZEGwkZyRgbgDp --all --global --yes

Quick Start

# Sign in through your browser
shein-open login

# Choose the app and test store for this work
shein-open apps list
shein-open apps use <appid>
shein-open test-store list
shein-open test-store use <testCustomerId>

# Call a documented Open API
shein-open api call /open-api/order/order-list --body '{"page":1,"pageSize":10}'

Run shein-open --help or shein-open <command> --help for command-specific help.

Commands

Authentication

Command Description
shein-open login Sign in through the SHEIN Open Platform in your browser.
shein-open logout Sign out from the current CLI profile.
shein-open auth status Show the current sign-in state.
shein-open whoami Show the active developer and CLI context.

App and Test Store

Command Description
shein-open apps list List apps available to the signed-in developer.
shein-open apps use <appid> Select the app for subsequent commands.
shein-open apps current Show the selected app.
shein-open test-store list List test stores for the selected app.
shein-open test-store use <testCustomerId> Select a test store.
shein-open test-store current Show the selected test store.

Call Open APIs

Use api call with a path confirmed in the SHEIN Open Platform documentation. The CLI uses the selected app and test store.

shein-open api call <path> [flags]
Flag Description
--method HTTP method. Defaults to POST.
--body JSON request body. Use @file or - for standard input.
--params JSON query parameters. Use @file or - for standard input.
-H, --header Extra request header in Name:Value form. Repeat as needed.
--auth-mode Authentication mode: open-key or app-key.
--language Response language. Defaults to the current CLI language.

Examples:

shein-open api call /open-api/openapi-business-backend/product/full-detail \
  --body '{"goodsSn":"example-goods-sn"}'

shein-open api call /open-api/order/order-list \
  --params '{"page":1,"pageSize":50}'

shein-open api call /open-api/goods/save --method POST --body @request.json

Test Tools

Use Portal test tools after selecting a test store.

# List order creation scenes for the selected store
shein-open test order list scene

# Create data for one listed order scene
shein-open test order --tool-id <toolId>

# Run product pre-validation with a prepared request file
shein-open test product --file product.json \
  --srm-supplier-id <id> --srm-supplier-source <source>

Language and Updates

# Show or change CLI language
shein-open language
shein-open language zh
shein-open language en

# Check and install CLI updates
shein-open version
shein-open upgrade --check
shein-open upgrade --yes

Skills installed through Skills.sh are updated separately by re-adding the official Pack. For a global installation:

npx --yes skills@1.5.21 add https://skills.sh/p/PI4ZEGwkZyRgbgDp --skill <skill-name> --global --yes

For a project-scoped Skill, omit --global:

npx --yes skills@1.5.21 add https://skills.sh/p/PI4ZEGwkZyRgbgDp --skill <skill-name> --yes

Usage Data

The CLI sends limited operational usage data, such as the command name, result, duration, and CLI version, to help improve reliability. It does not include credentials, request arguments, API request or response bodies, local files, or command output.

Set SHEIN_OPEN_TELEMETRY=0 to disable usage data collection.


SHEIN 开放平台 CLI

SHEIN 开放平台 CLI(npm 包,命令:shein-open)帮助开发者在终端中使用开放平台 App。可用于登录、选择 App 和测试店铺、调用已确认的 Open API,以及准备测试数据。

使用前准备

请安装 Node.js 20 或更高版本。还需要已开通的 SHEIN 开放平台开发者账号和 App 访问权限。

npm install -g shein-open-cli

安装 SHEIN Skill Pack

CLI 和 Skill Pack 独立安装、独立更新。通过以下命令为 AI 编程助手安装官方 SHEIN Skill Pack

npx --yes skills@1.5.21 add https://skills.sh/p/PI4ZEGwkZyRgbgDp --all --global --yes

快速开始

# 通过浏览器登录
shein-open login

# 选择本次操作使用的 App 和测试店铺
shein-open apps list
shein-open apps use <appid>
shein-open test-store list
shein-open test-store use <testCustomerId>

# 调用已在文档中确认的 Open API
shein-open api call /open-api/order/order-list --body '{"page":1,"pageSize":10}'

执行 shein-open --helpshein-open <command> --help 可查看命令帮助。

命令

登录

命令 说明
shein-open login 通过浏览器登录 SHEIN 开放平台。
shein-open logout 登出当前 CLI Profile。
shein-open auth status 查看当前登录状态。
shein-open whoami 查看当前开发者和 CLI 上下文。

App 和测试店铺

命令 说明
shein-open apps list 列出当前开发者可用的 App。
shein-open apps use <appid> 选择后续命令使用的 App。
shein-open apps current 查看当前选中的 App。
shein-open test-store list 列出当前 App 可用的测试店铺。
shein-open test-store use <testCustomerId> 选择测试店铺。
shein-open test-store current 查看当前选中的测试店铺。

调用 Open API

使用 api call 调用已经在 SHEIN 开放平台文档中确认的接口路径。CLI 会使用当前选中的 App 和测试店铺。

shein-open api call <path> [flags]
参数 说明
--method HTTP 方法,默认 POST
--body JSON 请求体,支持 @文件-(标准输入)。
--params JSON 查询参数,支持 @文件-(标准输入)。
-H--header 附加请求头,格式为 Name:Value,可重复使用。
--auth-mode 认证模式:open-keyapp-key
--language 响应语言,默认使用当前 CLI 语言。

示例:

shein-open api call /open-api/openapi-business-backend/product/full-detail \
  --body '{"goodsSn":"example-goods-sn"}'

shein-open api call /open-api/order/order-list \
  --params '{"page":1,"pageSize":50}'

shein-open api call /open-api/goods/save --method POST --body @request.json

测试工具

选择测试店铺后,可以使用 Portal 测试工具。

# 列出当前店铺可创建的订单场景
shein-open test order list scene

# 为一个已列出的订单场景创建数据
shein-open test order --tool-id <toolId>

# 使用已准备的请求文件执行商品预检
shein-open test product --file product.json \
  --srm-supplier-id <id> --srm-supplier-source <source>

语言和更新

# 查看或切换 CLI 语言
shein-open language
shein-open language zh
shein-open language en

# 检查和安装 CLI 更新
shein-open version
shein-open upgrade --check
shein-open upgrade --yes

通过 Skills.sh 安装的 Skill 需要重新添加官方 Pack 进行更新。全局安装的 Skill 使用:

npx --yes skills@1.5.21 add https://skills.sh/p/PI4ZEGwkZyRgbgDp --skill <skill-name> --global --yes

项目级安装的 Skill 去掉 --global

npx --yes skills@1.5.21 add https://skills.sh/p/PI4ZEGwkZyRgbgDp --skill <skill-name> --yes

使用数据

CLI 会发送有限的运行数据,例如命令名称、结果、耗时和 CLI 版本,用于改进稳定性。不会包含凭据、请求参数、API 请求或响应体、本地文件或命令输出。

设置 SHEIN_OPEN_TELEMETRY=0 可关闭使用数据采集。

About

The SHEIN Open Platform CLI (shein-open) helps you work with your Open Platform app from the terminal. Use it to sign in, select an app and test store, call documented Open APIs, and prepare test data.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages