---
title: "获取礼品卡操作记录"
description: "用于获取特定礼品卡的操作记录列表。"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/gift-card/get-gift-card-operation-records'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/gift-card/get-gift-card-operation-records.md'
---
# 获取礼品卡操作记录

用于获取特定礼品卡的操作记录列表。

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

## Endpoint

```http
GET /gift_cards/:gift_card_id/operation_records.json
```

## Base URL

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

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

## Required Permissions

* `read_gift_card`

## Request

### Path Parameters

* `gift_card_id`

  string (required)

  礼品卡编号

### Query Parameters

* `createtime_at_max`

  string (optional)

  创建时间在 XXX 前（格式见ISO8601），最大可查询近 180 天数据

* `createtime_at_min`

  string (optional)

  创建时间在 XXX 起（格式见ISO8601），最大可查询近 180 天数据

* `limit`

  string (optional)

  查询数量限制，默认 50 个，最大不能超过 250 个

* `operation_type`

  string (optional)

  礼品卡操作类型：使用逗号“,”分隔多个值；如果未填写，则返回所有类型
  | 类型值 | 描述 |
  | --- | --- |
  | OPERATE_ACTION_DEDUCT | 礼品卡支付扣减 |
  | OPERATE_ACTION_REFUND | 礼品卡退款归还 |
  | OPERATE_ACTION_ADJUST_BALANCE | 第三方应用调整余额 |
  

* `page_info`

  string (optional)

  分页查询的唯一标识，用于定位特定页面。
  
  该字段值需要在你已经查询完分页信息后，在该接口响应头中的 `link` 字段值中获取。例如，你获取到的 `link` 的值为 `<https://{handle}.myshopline.com/admin/openapi/{version}/gift_cards/:gift_card_id/operation_records.json?limit=1&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9>; rel="next"` ，那么 `page_info` 的值为 `eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9` 。
  
  关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。

* `sort_order`

  string (optional)

  按照使用时间排序
  | 排序值 | 描述 |
  | --- | --- |
  | asc | 按使用时间升序 |
  | desc | 按使用时间降序，默认值 |
  
  

### 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`

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

* `link`

  提供分页数据的 URL 链接。你可以获取该字段值中的 `page_info` 信息用于下一次分页请求中。
  
  当你请求的页面存在上一页或下一页的时候，该字段会被返回。关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。

### Response Body

#### 200

* `created_at`

  string

  礼品卡创建时间

* `customer_id`

  string

  当前礼品卡分配给的客户的客户ID

* `gift_card_id`

  string

  礼品卡编号

* `gift_card_records`

  array<object>

  礼品卡操作记录列表

  * `created_at`

    string

    礼品卡记录创建时间

  * `cur_balance`

    integer

    变更后余额

  * `id`

    string

    礼品卡操作记录编号

  * `last_balance`

    integer

    变更前余额

  * `operation_type`

    string

    礼品卡操作类型
    | 类型值 | 描述 |
    | --- | --- |
    | OPERATE_ACTION_DEDUCT | 礼品卡支付扣减 |
    | OPERATE_ACTION_REFUND | 礼品卡退款归还 |
    | OPERATE_ACTION_ADJUST_BALANCE | 第三方应用调整余额 |
    

  * `order_id`

    string

    使用礼品卡支付的订单号

  * `pay_seq`

    string

    使用礼品卡支付的支付单号

  * `refund_id`

    string

    使用礼品卡支付的退款单号

* `status`

  string

  礼品卡状态，enabled：启用中，disabled：未启用

* `count`

  integer

  总记录数


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "description": "用于获取特定礼品卡的操作记录列表。",
  "externalDocs": {
    "description": "接口使用的权限点: `read_gift_card` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "ZtH7r8BS",
  "parameters": [
    {
      "name": "gift_card_id",
      "in": "path",
      "description": "礼品卡编号",
      "required": true,
      "style": "simple",
      "schema": {
        "name": "gift_card_id",
        "description": "礼品卡编号",
        "type": "string",
        "example": "30157043359245339231360282"
      },
      "example": "30157043359245339231360282"
    },
    {
      "name": "createtime_at_max",
      "in": "query",
      "description": "创建时间在 XXX 前（格式见ISO8601），最大可查询近 180 天数据",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "createtime_at_max",
        "description": "创建时间在 XXX 前（格式见ISO8601），最大可查询近 180 天数据",
        "type": "string",
        "example": "2021-09-04T14:11:54+00:00"
      },
      "example": "2021-09-04T14:11:54+00:00"
    },
    {
      "name": "createtime_at_min",
      "in": "query",
      "description": "创建时间在 XXX 起（格式见ISO8601），最大可查询近 180 天数据",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "createtime_at_min",
        "description": "创建时间在 XXX 起（格式见ISO8601），最大可查询近 180 天数据",
        "type": "string",
        "example": "2021-09-02T14:11:54+00:00"
      },
      "example": "2021-09-02T14:11:54+00:00"
    },
    {
      "name": "limit",
      "in": "query",
      "description": "查询数量限制，默认 50 个，最大不能超过 250 个",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "limit",
        "description": "查询数量限制，默认 50 个，最大不能超过 250 个",
        "type": "string",
        "example": "100"
      },
      "example": "100"
    },
    {
      "name": "operation_type",
      "in": "query",
      "description": "礼品卡操作类型：使用逗号“,”分隔多个值；如果未填写，则返回所有类型\n| 类型值 | 描述 |\n| --- | --- |\n| OPERATE_ACTION_DEDUCT | 礼品卡支付扣减 |\n| OPERATE_ACTION_REFUND | 礼品卡退款归还 |\n| OPERATE_ACTION_ADJUST_BALANCE | 第三方应用调整余额 |\n",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "operation_type",
        "description": "礼品卡操作类型：使用逗号“,”分隔多个值；如果未填写，则返回所有类型\n| 类型值 | 描述 |\n| --- | --- |\n| OPERATE_ACTION_DEDUCT | 礼品卡支付扣减 |\n| OPERATE_ACTION_REFUND | 礼品卡退款归还 |\n| OPERATE_ACTION_ADJUST_BALANCE | 第三方应用调整余额 |\n",
        "type": "string",
        "example": "OPERATE_ACTION_DEDUCT,OPERATE_ACTION_REFUND"
      },
      "example": "OPERATE_ACTION_DEDUCT,OPERATE_ACTION_REFUND"
    },
    {
      "name": "page_info",
      "in": "query",
      "description": "分页查询的唯一标识，用于定位特定页面。\n\n该字段值需要在你已经查询完分页信息后，在该接口响应头中的 `link` 字段值中获取。例如，你获取到的 `link` 的值为 `<https://{handle}.myshopline.com/admin/openapi/{version}/gift_cards/:gift_card_id/operation_records.json?limit=1&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9>; rel=\"next\"` ，那么 `page_info` 的值为 `eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9` 。\n\n关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "page_info",
        "description": "调用方不需要使用和关注此字段，由Shopline自动封装",
        "type": "string",
        "example": "eyJzaW5jZUlkIjoiMzAxNTcwNDMzNTkyNDUzMzkyMzEzNjAyODIiLCJkaXJlY3Rpb24iOiJwcmV2Iiwic3RhdHVzIjoiZW5hYmxl"
      },
      "example": "eyJzaW5jZUlkIjoiMzAxNTcwNDMzNTkyNDUzMzkyMzEzNjAyODIiLCJkaXJlY3Rpb24iOiJwcmV2Iiwic3RhdHVzIjoiZW5hYmxl"
    },
    {
      "name": "sort_order",
      "in": "query",
      "description": "按照使用时间排序\n| 排序值 | 描述 |\n| --- | --- |\n| asc | 按使用时间升序 |\n| desc | 按使用时间降序，默认值 |\n\n",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "sort_order",
        "description": "按照使用时间排序\n| 排序值 | 描述 |\n| --- | --- |\n| asc | 按使用时间升序 |\n| desc | 按使用时间降序，默认值 |\n\n",
        "type": "string",
        "example": "desc"
      },
      "example": "desc"
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "style": "string",
      "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": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        },
        "link": {
          "description": "提供分页数据的 URL 链接。你可以获取该字段值中的 `page_info` 信息用于下一次分页请求中。\n\n当你请求的页面存在上一页或下一页的时候，该字段会被返回。关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。",
          "example": "<https://{handle}.myshopline.com/admin/openapi/{version}/gift_cards/:gift_card_id/operation_records.json?limit=20&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9>; rel=\"previous\",<https://{handle}.myshopline.com/admin/openapi/{version}/gift_cards/:gift_card_id/operation_records.json?limit=20&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJwcmUiLCJsaW1pdCI6MX0=>; rel=\"next\""
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "created_at": {
                "name": "created_at",
                "description": "礼品卡创建时间",
                "type": "string",
                "example": "2023-08-16T23:59:59+08:00"
              },
              "customer_id": {
                "name": "customer_id",
                "description": "当前礼品卡分配给的客户的客户ID",
                "type": "string",
                "example": "4200113946"
              },
              "gift_card_id": {
                "name": "gift_card_id",
                "description": "礼品卡编号",
                "type": "string",
                "example": "30157043359245339231360282"
              },
              "gift_card_records": {
                "name": "gift_card_records",
                "description": "礼品卡操作记录列表",
                "type": "array",
                "items": {
                  "name": "gift_card_records",
                  "description": "礼品卡操作记录列表",
                  "type": "object",
                  "properties": {
                    "created_at": {
                      "name": "created_at",
                      "description": "礼品卡记录创建时间",
                      "type": "string",
                      "example": "2023-08-16T23:59:59+08:00"
                    },
                    "cur_balance": {
                      "name": "cur_balance",
                      "description": "变更后余额",
                      "type": "integer",
                      "example": 100
                    },
                    "id": {
                      "name": "id",
                      "description": "礼品卡操作记录编号",
                      "type": "string",
                      "example": "5504120995916023830"
                    },
                    "last_balance": {
                      "name": "last_balance",
                      "description": "变更前余额",
                      "type": "integer",
                      "example": 50
                    },
                    "operation_type": {
                      "name": "operation_type",
                      "description": "礼品卡操作类型\n| 类型值 | 描述 |\n| --- | --- |\n| OPERATE_ACTION_DEDUCT | 礼品卡支付扣减 |\n| OPERATE_ACTION_REFUND | 礼品卡退款归还 |\n| OPERATE_ACTION_ADJUST_BALANCE | 第三方应用调整余额 |\n",
                      "type": "string",
                      "example": "OPERATE_ACTION_DEDUCT"
                    },
                    "order_id": {
                      "name": "order_id",
                      "description": "使用礼品卡支付的订单号",
                      "type": "string",
                      "example": "21055050822459866501338306"
                    },
                    "pay_seq": {
                      "name": "pay_seq",
                      "description": "使用礼品卡支付的支付单号",
                      "type": "string",
                      "example": "23062186831987862878904657"
                    },
                    "refund_id": {
                      "name": "refund_id",
                      "description": "使用礼品卡支付的退款单号",
                      "type": "string",
                      "example": "2605514230128707114121"
                    }
                  },
                  "example": {
                    "order_id": "21055050822459866501338306",
                    "pay_seq": "23062186831987862878904657",
                    "refund_id": "2605514230128707114121",
                    "created_at": "2023-08-16T23:59:59+08:00",
                    "cur_balance": 100,
                    "id": "5504120995916023830",
                    "last_balance": 50,
                    "operation_type": "OPERATE_ACTION_DEDUCT"
                  }
                },
                "example": [
                  {
                    "operation_type": "OPERATE_ACTION_DEDUCT",
                    "order_id": "21055050822459866501338306",
                    "pay_seq": "23062186831987862878904657",
                    "refund_id": "2605514230128707114121",
                    "created_at": "2023-08-16T23:59:59+08:00",
                    "cur_balance": 100,
                    "id": "5504120995916023830",
                    "last_balance": 50
                  }
                ]
              },
              "status": {
                "name": "status",
                "description": "礼品卡状态，enabled：启用中，disabled：未启用",
                "type": "string",
                "example": "enabled"
              },
              "count": {
                "name": "count",
                "description": "总记录数",
                "type": "integer",
                "example": 10
              }
            },
            "example": {
              "status": "enabled",
              "count": 10,
              "created_at": "2023-08-16T23:59:59+08:00",
              "customer_id": "4200113946",
              "gift_card_id": "30157043359245339231360282",
              "gift_card_records": [
                {
                  "refund_id": "2605514230128707114121",
                  "created_at": "2023-08-16T23:59:59+08:00",
                  "cur_balance": 100,
                  "id": "5504120995916023830",
                  "last_balance": 50,
                  "operation_type": "OPERATE_ACTION_DEDUCT",
                  "order_id": "21055050822459866501338306",
                  "pay_seq": "23062186831987862878904657"
                }
              ]
            }
          }
        }
      }
    },
    "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": "/gift_cards/:gift_card_id/operation_records.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_gift_card"
  ]
}
```