DescribeTransactionHistory

1. 接口描述

调用本接口用于获取账户的交易记录。最大返回条数为10000。不能查询超过10000条的数据

2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

参数名称
必选
类型
描述

pageNum

Integer

页码,默认1

pageSize

Integer

每页大小,不能超过10000

transactionType

交易类型

startTime

Date

开始时间,默认一个月前(开始结束时间不允许大于3个月)

endTime

Date

结束时间,默认当前时间

3. 响应结果

参数名称
类型
描述

requestId

String

唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 requestId。

incomeSum

Double

总收入

expenditureSum

Double

总支出

totalCount

Integer

符合条件的数据总数。

dataSet

结果集。

4. 代码示例

  1. 获取账户的交易记录

POST /api/v2/zbc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeTransactionHistory
<Common Request Params>

Request:
{
  "endTime": "2023-09-05T14:26:18Z",
  "startTime": "2023-08-05T14:26:18Z",
  "transactionType":["DEDUCTION"],
  "pageSize": 3,
  "pageNum": 1
}

Response:
{
    "requestId": "TDC8274BB-68DF-42A8-A827-5933DB122667",
    "response": {
        "incomeSum": 605.86,
        "requestId": "TDC8274BB-68DF-42A8-A827-5933DB122667",
        "totalCount": 15084,
        "dataSet": [
            {
                "transactionType": "DEDUCTION",
                "uid": "8b2875e7-1340-4a3d-a056-a885c32f25de",
                "amount": 1.38,
                "tradeNo": "f2c7f250-45ed-4734-8e03-e4ab5766da46",
                "orderSn": "967674789101568984",
                "cashBalance": 161.358301,
                "paymentMethod": "ZenPoint",
                "description": "Product: Virtual Machine - Elastic Disk//\nType: ens_ssd/FRA/de-frankfurt-9a - hourly billing",
                "transactionTime": "2023-09-05T13:00:42Z",
                "accountUid": "21205dbb-d08a-4f79-927d-861d47bc66d8",
                "tradeType": "EXPENDITURE"
            },
            {
                "transactionType": "DEDUCTION",
                "uid": "223ec330-0148-4745-a33b-f5264b14aacf",
                "amount": 0.05,
                "tradeNo": "a307e306-634e-4168-9549-2ac9dfaa4a33",
                "orderSn": "967674789101568984",
                "cashBalance": 162.738301,
                "paymentMethod": "ZenPoint",
                "description": "Product: Virtual Machine - Instance Type//\nType: 01.VM.02.019/FRA9A_Shared_6326 - hourly billing",
                "transactionTime": "2023-09-05T13:00:42Z",
                "accountUid": "21205dbb-d08a-4f79-927d-861d47bc66d8",
                "tradeType": "EXPENDITURE"
            },
            {
                "transactionType": "DEDUCTION",
                "uid": "dc143cb6-ea9b-4c3e-9f46-660dace8b1a2",
                "amount": 0.01,
                "tradeNo": "628094dd-f2c0-45b3-b2ca-8144d7eac08f",
                "orderSn": "927099701663115480",
                "cashBalance": 162.788301,
                "paymentMethod": "ZenPoint",
                "description": "Product: Virtual Elastic Disk - Elastic Disk//\nType: ens_ssd/SIN/sg-singapore-3 - hourly billing",
                "transactionTime": "2023-09-05T13:00:40Z",
                "accountUid": "21205dbb-d08a-4f79-927d-861d47bc66d8",
                "tradeType": "EXPENDITURE"
            }
        ],
        "expenditureSum": 7044.32
    }
}

5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的开发工具集(SDK),未来会陆续支持更多开发语言,方便快速接入和使用Zenlayer的产品和服务。

6. 错误码

下面包含业务逻辑中遇到的错误码,其他错误码见公共错误码

HTTP Status Code
Error Code
Description

400

CAN_NOT_GET_THAN_10000

不能请求超过10000条的数据

400

TIME_MORE_THAN_3_MONTHS

查询时间区间不能超过3个月

最后更新于