---
title: "应用安装状态变更"
description: "当商店安装或卸载应用时，平台会向应用发送事件通知。"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/webhook/application/app-installation-status-changed'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/webhook/application/app-installation-status-changed.md'
---
# 应用安装状态变更

当商店安装或卸载应用时，平台会向应用发送事件通知。

- **API Version:** v20270301
- **API Type:** Webhook
- **API Protocol:** RESTful

## Request

### Request Headers

* `X-Shopline-Topic`

  string (required)

  事件的唯一标识。

* `X-Shopline-Hmac-Sha256`

  string (required)

  该请求的签名。收到请求后，你需要对该签名进行 [验签](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/generate-and-verify-signatures.md#post-请求操作步骤) 以验证数据的真实性和完整性。

* `X-Shopline-Shop-Domain`

  string (required)

  店铺的域名。

* `X-Shopline-Shop-Id`

  string (required)

  店铺 ID。

* `X-Shopline-Merchant-Id`

  string (required)

  商家 ID。

* `X-Shopline-API-Version`

  string (required)

  API 版本号。

* `X-Shopline-Webhook-Id`

  string (required)

  该 Webhook 事件的 ID。

### Request Body

* `appkey`

  string

  应用的全局唯一标识符。

* `country_code`

  string

  店铺所在的国家或地区，遵循 [ISO 3166-1 (alpha 2)](https://www.iso.org/iso-3166-country-codes.html)  国际标准的二位国家或区域码。

* `created_at`

  string

  事件发生的精确时间。  
  格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)，时区为店铺所在时区。
  
  :::note{title="note"}
  `created_at` 和 `timestamp` 是等价的，用于兼容不同开发者的需求。 
  :::

* `handle`

  string

  店铺在 SHOPLINE 系统中的唯一标识符，对应域名中 `{handle}.myshopline.com` 的 `{handle}` 部分。  

* `merchant_id`

  string

  商户的全局唯一标识符 ID，用于识别商户。 

* `name`

  string

  店铺当前显示名称（商家可修改的非固定标识）。  

* `operate`

  string

  当前执行的操作类型。有效枚举值包含：  
  + `INSTALL`：应用安装  
  + `UNINSTALL`：应用卸载  

* `store_id`

  string

  店铺的全局唯一标识符 ID。 

* `timestamp`

  long

  事件发生的时间。格式为 13 位毫秒级时间戳。 
  
  :::note{title="note"}
  `created_at` 和 `timestamp` 是等价的，用于兼容不同开发者的需求。 
  :::

* `timezone`

  string

  店铺使用的 [IANA 时区](https://data.iana.org/time-zones/tzdb-2021a/zone1970.tab) 标识符。 
  
  例如：
  + `America/New_York`: 美国东部时间
  + `Asia/Tokyo`: 日本标准时间

## Response

### Status Codes

* `200`

  收到 SHOPLINE 发送的 Webhook 通知后，你需要按照如下 SHOPLINE 要求的格式进行响应。
  
  ``` HTTP/1.1 200 OK ``` 
  
  关于如何订阅 Webhooks 及更多 Webhook 响应规则说明，请参考 [Webhook 概述](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/webhooks/overview.md)。

### Response Body

#### 200

_No response body_

## OpenAPI Definition

```json
{
  "description": "当商店安装或卸载应用时，平台会向应用发送事件通知。",
  "externalDocs": {
    "description": "| 事件分组 | 事件标识 |\n| :------: | :------: |\n|apps        |apps/installed_uninstalled        |\n",
    "url": "",
    "errorTableDescription": ""
  },
  "operationId": "ZwxzjToT",
  "parameters": [
    {
      "name": "X-Shopline-Topic",
      "in": "header",
      "description": "事件的唯一标识。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Topic",
        "description": "事件的唯一标识。",
        "type": "string",
        "example": "orders/edited"
      },
      "example": "orders/edited"
    },
    {
      "name": "X-Shopline-Hmac-Sha256",
      "in": "header",
      "description": "该请求的签名。收到请求后，你需要对该签名进行 [验签](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/generate-and-verify-signatures.md#post-请求操作步骤) 以验证数据的真实性和完整性。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Hmac-Sha256",
        "description": "该请求的签名。收到请求后，你需要对该签名进行 [验签](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/generate-and-verify-signatures.md#post-请求操作步骤) 以验证数据的真实性和完整性。",
        "type": "string",
        "example": "XWmrwMey6OsLMeiZKwP4FppHH3cmAiiJJAweH5Jo4bM="
      },
      "example": "XWmrwMey6OsLMeiZKwP4FppHH3cmAiiJJAweH5Jo4bM="
    },
    {
      "name": "X-Shopline-Shop-Domain",
      "in": "header",
      "description": "店铺的域名。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Shop-Domain",
        "description": "店铺的域名。",
        "type": "string",
        "example": "example.myshopline.com"
      },
      "example": "example.myshopline.com"
    },
    {
      "name": "X-Shopline-Shop-Id",
      "in": "header",
      "description": "店铺 ID。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Shop-Id",
        "description": "店铺 ID。",
        "type": "string",
        "example": "1610418123456"
      },
      "example": "1610418123456"
    },
    {
      "name": "X-Shopline-Merchant-Id",
      "in": "header",
      "description": "商家 ID。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Merchant-Id",
        "description": "商家 ID。",
        "type": "string",
        "example": "2000001234"
      },
      "example": "2000001234"
    },
    {
      "name": "X-Shopline-API-Version",
      "in": "header",
      "description": "API 版本号。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-API-Version",
        "description": "API 版本号。",
        "type": "string",
        "example": "v20250601"
      },
      "example": "v20250601"
    },
    {
      "name": "X-Shopline-Webhook-Id",
      "in": "header",
      "description": "该 Webhook 事件的 ID。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Webhook-Id",
        "description": "该 Webhook 事件的 ID。",
        "type": "string",
        "example": "b54557e48a5fbf7d70bcd043"
      },
      "example": "b54557e48a5fbf7d70bcd043"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "appkey": {
              "name": "appkey",
              "description": "应用的全局唯一标识符。",
              "type": "string",
              "example": "35f91ba37b941e6ce5fcc67975ab7aafb0a12345"
            },
            "country_code": {
              "name": "country_code",
              "description": "店铺所在的国家或地区，遵循 [ISO 3166-1 (alpha 2)](https://www.iso.org/iso-3166-country-codes.html)  国际标准的二位国家或区域码。",
              "type": "string",
              "example": "US"
            },
            "created_at": {
              "name": "created_at",
              "description": "事件发生的精确时间。  \n格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)，时区为店铺所在时区。\n\n:::note{title=\"note\"}\n`created_at` 和 `timestamp` 是等价的，用于兼容不同开发者的需求。 \n:::",
              "type": "string",
              "example": "2024-04-01T14:01:23+08:00"
            },
            "handle": {
              "name": "handle",
              "description": "店铺在 SHOPLINE 系统中的唯一标识符，对应域名中 `{handle}.myshopline.com` 的 `{handle}` 部分。  ",
              "type": "string",
              "example": "smartstore"
            },
            "merchant_id": {
              "name": "merchant_id",
              "description": "商户的全局唯一标识符 ID，用于识别商户。 ",
              "type": "string",
              "example": "2000001234"
            },
            "name": {
              "name": "name",
              "description": "店铺当前显示名称（商家可修改的非固定标识）。  ",
              "type": "string",
              "example": "SHOPLINE Store"
            },
            "operate": {
              "name": "operate",
              "description": "当前执行的操作类型。有效枚举值包含：  \n+ `INSTALL`：应用安装  \n+ `UNINSTALL`：应用卸载  ",
              "type": "string",
              "example": ""
            },
            "store_id": {
              "name": "store_id",
              "description": "店铺的全局唯一标识符 ID。 ",
              "type": "string",
              "example": "1610418123456"
            },
            "timestamp": {
              "name": "timestamp",
              "description": "事件发生的时间。格式为 13 位毫秒级时间戳。 \n\n:::note{title=\"note\"}\n`created_at` 和 `timestamp` 是等价的，用于兼容不同开发者的需求。 \n:::",
              "type": "long",
              "example": 1293941471000
            },
            "timezone": {
              "name": "timezone",
              "description": "店铺使用的 [IANA 时区](https://data.iana.org/time-zones/tzdb-2021a/zone1970.tab) 标识符。 \n\n例如：\n+ `America/New_York`: 美国东部时间\n+ `Asia/Tokyo`: 日本标准时间",
              "type": "string",
              "example": ""
            }
          },
          "example": {
            "appkey": "35f91ba37b941e6ce5fcc67975ab7aafb0a12345",
            "country_code": "US",
            "created_at": "2024-04-01T14:01:23+08:00",
            "handle": "smartstore",
            "merchant_id": "2000001234",
            "name": "SHOPLINE Store",
            "operate": "",
            "store_id": "1610418123456",
            "timestamp": 1293941471000,
            "timezone": ""
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "收到 SHOPLINE 发送的 Webhook 通知后，你需要按照如下 SHOPLINE 要求的格式进行响应。\n\n``` HTTP/1.1 200 OK ``` \n\n关于如何订阅 Webhooks 及更多 Webhook 响应规则说明，请参考 [Webhook 概述](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/webhooks/overview.md)。"
    }
  },
  "info": {
    "title": "应用安装状态变更",
    "version": "v20270301"
  },
  "exampleDocs": [
    {
      "postExample": "{\n  \"appkey\": \"35f91ba37b941e6ce5fcc67975ab7aafb0a12345\",\n  \"country_code\": \"US\",\n  \"created_at\": \"2024-04-01T14:01:23+08:00\",\n  \"handle\": \"shopline\",\n  \"merchant_id\": \"2000001234\",\n  \"name\": \"SHOPLINE Store\",\n  \"operate\": \"UNINSTALL\",\n  \"store_id\": \"1610418123456\",\n  \"timestamp\": 1293941471000,\n  \"timezone\": \"Asia/Singapore\"\n}",
      "scenes": "应用卸载",
      "isDefault": true,
      "lang": "zh"
    }
  ]
}
```