# 简介

Mshop 提供了一套API，使开发人员可以扩展平台的内置功能。这些API允许合作伙伴读取和写入商家数据，与其他系统和平台进行相互操作以及向 **Mshop** 添加新功能。

### 使用API的要求 <a href="#shi-yong-api-de-yao-qiu" id="shi-yong-api-de-yao-qiu"></a>

* 所有 API 均需遵守 Mshop API 许可和使用条款
* 所有 API 均受速率限制，具体限制方式见使用说明部分的速率限制章节。
* 所有 API 都要求开发人员进行身份验证
* 所有 API 已版本化

## API身份验证 <a href="#api-shen-fen-yan-zheng" id="api-shen-fen-yan-zheng"></a>

为了确保平台上的数据安全可靠，进行 API 调用时，所有与我们 API 连接的应用都必须进行身份验证

### 认证类型 <a href="#ren-zheng-lei-xing" id="ren-zheng-lei-xing"></a>

平台对应用进行身份验证的使用 **Access-Token** 验证。目前开放给第三方的称为私有应用。

### 私有应用的 Access-Token 验证 <a href="#si-you-cha-jian-de-accesstoken-yan-zheng" id="si-you-cha-jian-de-accesstoken-yan-zheng"></a>

私有应用使用基本的 Access-Token 验证，在管理后台应用市场内创建私有应用以获取 Access-Token，然后使用调用API中提到的方式进行API调用。API版本指的是生成Webhook消息的 API版本，具体信息如下图所示：

<figure><img src="https://3753343335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgq6W-O3Zv1VuaZcgv6%2Fuploads%2Fj6ZN9CYYwIScOUFD3wam%2Fimage.png?alt=media&#x26;token=8d4d360a-ccb3-4031-bcca-03b8c4d49932" alt=""><figcaption></figcaption></figure>

### API使用方法 <a href="#scope-lie-biao" id="scope-lie-biao"></a>

在请求头中，带上 `Authorization: Bearer <token>`完成授权,

```
curl -i -X GET \
     -H "Content-Type:application/json" \
     -H "Authorization:Bearer <token>"  \
     'https://store.hotishop.com/openapi/2021-08/orders'
```

### scope列表 <a href="#scope-lie-biao" id="scope-lie-biao"></a>

* read\_products, write\_products
* read\_orders, write\_orders
* read\_customers, write\_customers
* read\_collection&#x73;*,* write\_collections
* read\_script\_tags,write\_script\_tag

{% hint style="info" %}
scopes 详情请查看 [权限列表](https://developers.hotishop.com/shi-yong-shuo-ming/quan-xian-lie-biao)
{% endhint %}

## API版本控制 <a href="#api-ban-ben-kong-zhi" id="api-ban-ben-kong-zhi"></a>

Mshop 平台由于迭代开发速度很快，将会提供不同的API版本。

{% hint style="info" %}
了解有关[ API版本控制](https://developers.hotishop.com/open-api/versioning) 更多信息
{% endhint %}

### 发布时间表 <a href="#fa-bu-shi-jian-biao" id="fa-bu-shi-jian-biao"></a>

<table data-header-hidden><thead><tr><th width="149">发布版本</th><th width="228.66666666666666">发布时间点</th><th width="176">不再支持版本日期</th><th>备注</th></tr></thead><tbody><tr><td>发布版本</td><td>发布时间点</td><td>不再支持版本日期</td><td>备注</td></tr><tr><td><strong>2021-08</strong></td><td>2021年08月01日</td><td>2024年04月01日</td><td>调用此版本自动滚动至最旧稳定版本</td></tr><tr><td><strong>2023-10</strong></td><td>2023年10月01日</td><td>2025年04月01日</td><td>最旧稳定版本</td></tr><tr><td><strong>2024-10</strong></td><td>2024年10月01日</td><td>2025 年 10 月01 日</td><td>最新稳定版本</td></tr><tr><td><strong>2025-04</strong></td><td>2024年10月01日</td><td>2026年04月01日</td><td>开发版本</td></tr></tbody></table>

### 带版本的API调用 <a href="#dai-ban-ben-de-api-tiao-yong" id="dai-ban-ben-de-api-tiao-yong"></a>

```
RESTful API URL： /openapi/{version}/{endpoint}
```

例如，以下 URL 调用 version `2021-08`：

```
RESTful API URL： /openapi/2021-08/products
```
