Skip to content

交易 API

公共数据结构

TransactionType

类型描述
1integer修改余额
2integer收入
3integer支出
4integer转账

TransactionInfoResponse

字段类型描述
idstring交易 ID
timeSequenceIdstring交易时间序列 ID
typeTransactionType交易类型
categoryIdstring交易分类 ID
categoryTransactionCategoryInfoResponse交易分类对象
timeinteger交易时间(Unix Time)
utcOffsetinteger交易时区偏移(分钟)
sourceAccountIdstring来源账户 ID
sourceAccountAccountInfoResponse来源账户对象
destinationAccountIdstring目标账户 ID
destinationAccountAccountInfoResponse目标账户对象
sourceAmountinteger来源金额
destinationAmountinteger目标金额
hideAmountboolean是否隐藏金额
tagIdsstring[]交易标签 IDs
tagsTransactionTagInfoResponse[]交易标签对象列表
picturesTransactionPictureInfoBasicResponse[]交易图片列表
commentstring交易描述
geoLocationTransactionGeoLocationResponse交易地理位置
editableboolean交易是否可编辑

TransactionPictureInfoBasicResponse

字段类型描述
pictureIdstring交易图片 ID
originalUrlstring交易图片 URL

TransactionGeoLocationRequest

字段类型描述
latitudefloat纬度
longitudefloat经度

TransactionGeoLocationResponse

字段类型描述
latitudefloat纬度
longitudefloat经度

获取交易列表

API 路径

transactions/list.json

HTTP 方法

GET

请求 Header

Header描述
X-Timezone-Offset时区偏移(分钟)

请求参数

字段类型必选描述
typeinteger可选根据交易类型(1:修改余额,2:收入,3:支出,4:转账)过滤交易
category_idsstring可选根据交易分类IDs(使用 , 分隔)过滤交易
account_idsstring可选根据账户IDs(使用 , 分隔)过滤交易
tag_filterstring可选根据交易标签过滤交易(支持多个标签组,每组间使用 ; 分隔。每个标签组格式为 type:tag_id1,tag_id2,...,其中 type 表示 交易标签过滤模式,0:交易包含本组所有标签,1:交易包含本组任意标签,2:交易不包含本组所有标签,3:交易不包含本组任意标签)
amount_filterstring可选根据余额过滤交易(大于金额:gt:{amount},小于金额:lt:{amount},等于金额:eq:{amount},不等于金额:ne:{amount},在两个金额之间:bt:{min_amount}:{max_amount},不在两个金额之间:ne:{min_amount}:{max_amount}
keywordstring可选根据关键词过滤交易
max_timeinteger可选最大时间序列Id(若获取最新内容设置为 0
min_timeinteger可选最小时间序列Id
pageinteger可选指定页码
countinteger必选每页交易的数量(最大为 50
with_countboolean可选是否获取所有交易总数量
with_picturesboolean可选是否获取图片IDs
trim_accountboolean可选是否获取账户ID而不是账户对象
trim_categoryboolean可选是否获取交易分类ID而不是交易分类对象
trim_tagboolean可选是否获取交易标签ID而不是交易标签对象

返回数据结构

TransactionInfoPageWrapperResponse[]

字段类型描述
itemsTransactionInfoResponse[]交易列表
nextTimeSequenceIdinteger请求更旧数据时的下一个游标(max_time 参数)
totalCountinteger交易总数量

添加交易

API 路径

transactions/add.json

HTTP 方法

POST

请求体 Content-Type

application/json

请求数据结构

TransactionCreateRequest

字段类型必选描述
typeTransactionType必选交易类型
categoryIdstring必选交易分类 ID
timeinteger必选交易时间(Unix Time)
utcOffsetinteger必选交易时区偏移(分钟)
sourceAccountIdstring必选来源账户 ID
destinationAccountIdstring可选目标账户 ID
sourceAmountinteger必选来源金额
destinationAmountinteger可选目标金额
hideAmountboolean可选是否隐藏金额
tagIdsstring[]可选交易标签 IDs
pictureIdsstring[]可选交易图片 IDs
commentstring可选交易描述
geoLocationTransactionGeoLocationRequest可选交易地理位置

Released under the MIT License.