---
title: "批量任务状态更新"
description: >
  [批量查询任务](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-bulk-query-task.md) 或 [批量变更任务](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-bulk-mutation-task.md) 的状态更新时触发。
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/webhook/batch-operation/bulk-task-status-updated'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/webhook/batch-operation/bulk-task-status-updated.md'
---
# 批量任务状态更新

[批量查询任务](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-bulk-query-task.md) 或 [批量变更任务](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-bulk-mutation-task.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

* `completedAt`

  string

  批量任务的完成时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

* `completedCount`

  integer

  批量操作的完成数量。

* `createdAt`

  string

  批量任务的创建时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

* `expiredAt`

  string

  批量任务的过期时间，超过该时间文件将无法下载。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

* `id`

  string

  批量操作任务 ID。

* `status`

  string

  批量任务状态。有效枚举值包含：
  
  - `CANCELED`：已取消   
  - `CANCELING`：取消中     
  - `COMPLETED`：已完成    
  - `CREATED`：已创建   
  - `EXPIRED`：已过期  
  - `FAILED`：已失败  
  - `RUNNING`：运行中  

* `type`

  string

  批量任务操作类型。有效枚举值包含：  
  - `QUERY`：查询操作  
  - `MUTATION`：变更操作，指通过 [创建一个批量变更任务（待废弃）](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-change-type-bulk-task-to-be-deprecated.md) 接口执行的变更操作。 
  - `MUTATION_GENERAL`：变更操作
  

* `url`

  string

  带有过期时间的文件 URL，包含所有任务处理结果。文件格式：[JSON Lines](https://jsonlines.org)。
  

## 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": "[批量查询任务](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-bulk-query-task.md) 或 [批量变更任务](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-bulk-mutation-task.md) 的状态更新时触发。",
  "externalDocs": {
    "description": "| 事件分组 | 事件标识 |\n| :------: | :------: |\n|others        |others/update        |\n",
    "url": "",
    "errorTableDescription": ""
  },
  "operationId": "v75i2o32",
  "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": {
            "completedAt": {
              "name": "completedAt",
              "description": "批量任务的完成时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
              "type": "string",
              "example": "2023-04-06T10:48:29+08:00"
            },
            "completedCount": {
              "name": "completedCount",
              "description": "批量操作的完成数量。",
              "type": "integer",
              "example": 0
            },
            "createdAt": {
              "name": "createdAt",
              "description": "批量任务的创建时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
              "type": "string",
              "example": "2023-04-06T10:48:29+08:00"
            },
            "expiredAt": {
              "name": "expiredAt",
              "description": "批量任务的过期时间，超过该时间文件将无法下载。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
              "type": "string",
              "example": "2023-04-06T10:48:29+08:00"
            },
            "id": {
              "name": "id",
              "description": "批量操作任务 ID。",
              "type": "string",
              "example": "gid://shopline/BulkOperation/f97a8c3304b98bcee17c12a0ceb85573"
            },
            "status": {
              "name": "status",
              "description": "批量任务状态。有效枚举值包含：\n\n- `CANCELED`：已取消   \n- `CANCELING`：取消中     \n- `COMPLETED`：已完成    \n- `CREATED`：已创建   \n- `EXPIRED`：已过期  \n- `FAILED`：已失败  \n- `RUNNING`：运行中  ",
              "type": "string",
              "example": ""
            },
            "type": {
              "name": "type",
              "description": "批量任务操作类型。有效枚举值包含：  \n- `QUERY`：查询操作  \n- `MUTATION`：变更操作，指通过 [创建一个批量变更任务（待废弃）](https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/create-a-change-type-bulk-task-to-be-deprecated.md) 接口执行的变更操作。 \n- `MUTATION_GENERAL`：变更操作\n",
              "type": "string",
              "example": ""
            },
            "url": {
              "name": "url",
              "description": "带有过期时间的文件 URL，包含所有任务处理结果。文件格式：[JSON Lines](https://jsonlines.org)。\n",
              "type": "string",
              "example": "https://sl-private-oss.oss-accelerate.example.com/task-jsonline/prod/1/9b0c0f04-53cb-4ae3-94db-79af6ec193bd.jsonl?Expires=1754059510"
            }
          },
          "example": {
            "completedAt": "2023-04-06T10:48:29+08:00",
            "completedCount": 0,
            "createdAt": "2023-04-06T10:48:29+08:00",
            "expiredAt": "2023-04-06T10:48:29+08:00",
            "id": "gid://shopline/BulkOperation/f97a8c3304b98bcee17c12a0ceb85573",
            "status": "",
            "type": "",
            "url": "https://sl-private-oss.oss-accelerate.example.com/task-jsonline/prod/1/9b0c0f04-53cb-4ae3-94db-79af6ec193bd.jsonl?Expires=1754059510"
          }
        }
      }
    },
    "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"
  }
}
```