---
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/admin-rest-api/bulk-operations/get-a-valid-bulk-task'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/bulk-operations/get-a-valid-bulk-task.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)。

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `read_bulkoperation`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
GET /current_bulk_operation.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。

## Required Permissions

* `read_bulkoperation`

## Request

### Query Parameters

* `type`

  string (optional)

  批量任务操作类型。有效枚举值包含：                                
   `QUERY` ：查询操作                                 
   `MUTATION`：变更操作

### Request Headers

* `Content-Type`

  string (required)

  字段值固定为 `application/json; charset=utf-8`。

* `Authorization`

  string (required)

  资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。

## Response

### Status Codes

* `200`

  更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。

### Response Body

#### 200

* `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。

* `reason`

  string

  批量任务执行异常的原因。

* `storeId`

  string

  店铺 ID。

* `errorCode`

  string

  批量任务错误码。有效枚举值包含：
  
  - `ACCESS_DENIED`: 无访问权限
  - `TIMEOUT`: 处理超时
  - `NO_DATA`: 没有找到数据

* `partialDataUrl`

  string

  带有过期时间的文件 URL。文件格式：[JSON Lines](https://jsonlines.org)。
  当 `status` 是 `COMPLETED` 时，该字段值与 `url` 值一致。其他状态下，可能包含部分任务处理结果。

* `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)。
  


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "tags": [
    "查询一个有效批量任务"
  ],
  "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": "接口使用的权限点: `read_bulkoperation` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "VObwvwC8",
  "parameters": [
    {
      "name": "type",
      "in": "query",
      "description": "批量任务操作类型。有效枚举值包含：                                \n `QUERY` ：查询操作                                 \n `MUTATION`：变更操作",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "type",
        "description": "批量任务操作类型。有效枚举值包含：                                \n `QUERY` ：查询操作                                 \n `MUTATION`：变更操作",
        "type": "string"
      },
      "examples": {
        "获取当前有效的批量查询任务": {
          "value": "QUERY"
        }
      }
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "responses": {
    "200": {
      "description": "更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。",
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "name": "body",
            "type": "object",
            "properties": {
              "completedAt": {
                "name": "completedAt",
                "description": "批量任务的完成日期与时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
                "type": "string"
              },
              "completedCount": {
                "name": "completedCount",
                "description": "批量操作的完成数量。",
                "type": "integer"
              },
              "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"
              },
              "id": {
                "name": "id",
                "description": "批量操作任务 ID。",
                "type": "string"
              },
              "reason": {
                "name": "reason",
                "description": "批量任务执行异常的原因。",
                "type": "string"
              },
              "storeId": {
                "name": "storeId",
                "description": "店铺 ID。",
                "type": "string"
              },
              "errorCode": {
                "name": "errorCode",
                "description": "批量任务错误码。有效枚举值包含：\n\n- `ACCESS_DENIED`: 无访问权限\n- `TIMEOUT`: 处理超时\n- `NO_DATA`: 没有找到数据",
                "type": "string"
              },
              "partialDataUrl": {
                "name": "partialDataUrl",
                "description": "带有过期时间的文件 URL。文件格式：[JSON Lines](https://jsonlines.org)。\n当 `status` 是 `COMPLETED` 时，该字段值与 `url` 值一致。其他状态下，可能包含部分任务处理结果。",
                "type": "string",
                "example": "https://sl-private-oss.oss-accelerate.example.com/task-jsonline/prod/1/9b0c0f04-53cb-4ae3-94db-79af6ec193bd.jsonl?Expires=1754059510"
              },
              "status": {
                "name": "status",
                "description": "批量任务状态。有效枚举值包含：\n\n- `CANCELED`：已取消   \n- `CANCELING`：取消中     \n- `COMPLETED`：已完成    \n- `CREATED`：已创建   \n- `EXPIRED`：已过期  \n- `FAILED`：已失败  \n- `RUNNING`：运行中  ",
                "type": "string"
              },
              "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"
              },
              "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": {
              "expiredAt": null,
              "id": null,
              "type": null,
              "completedAt": null,
              "errorCode": null,
              "partialDataUrl": "https://sl-private-oss.oss-accelerate.example.com/task-jsonline/prod/1/9b0c0f04-53cb-4ae3-94db-79af6ec193bd.jsonl?Expires=1754059510",
              "reason": null,
              "status": null,
              "storeId": null,
              "url": "https://sl-private-oss.oss-accelerate.example.com/task-jsonline/prod/1/9b0c0f04-53cb-4ae3-94db-79af6ec193bd.jsonl?Expires=1754059510",
              "completedCount": null,
              "createdAt": "2023-04-06T10:48:29+08:00"
            }
          },
          "examples": {
            "获取当前有效的批量查询任务": {
              "description": "查询当前店铺活跃的任务，处于活跃的任务最多只有一个",
              "value": {
                "errorCode": null,
                "id": "gid://shopline/BulkOperation/30b39695dddbea6bdf02da9400694468",
                "reason": null,
                "storeId": "1672369729606",
                "type": "QUERY",
                "url": null,
                "completedAt": null,
                "completedCount": 0,
                "createdAt": "2025-06-26T15:16:32+08:00",
                "expiredAt": null,
                "partialDataUrl": null,
                "status": "CREATED"
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "get",
  "path": "/current_bulk_operation.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。"
        }
      }
    }
  ],
  "info": {
    "title": "查询一个有效批量任务",
    "version": "v20270301"
  },
  "authIndexes": [
    "read_bulkoperation"
  ]
}
```