QuickBooks 时间卡片 API 文档
功能概述
此 API 提供了与 QuickBooks 时间卡片系统交互的功能,允许进行数据查询和操作。
主要功能:
- 获取和管理用户信息
- 操作工作时间记录
- 生成 payroll 和项目报告
- 配置和检索自定义字段
- 监控对象修改状态
- 管理通知和客户
用户相关接口
get_users
获取系统中的所有用户信息。
参数:
{
"page": number,
"limit": number
}
返回值:
{
"users": [],
"total_pages": number,
"current_page": number
}
get_user
根据 ID 获取单个用户信息。
参数:
{
"id": number
}
返回值:
{
"user": {
"id": number,
"name": string,
"email": string,
"status": string,
"role": string,
"time_zone": string,
"last_login": string,
"created_at": string,
"updated_at": string
}
}
create_user
创建新用户。
参数:
{
"name": string,
"email": string,
"password": string,
"role": string,
"time_zone": string
}
返回值:
{
"user": {
"id": number,
"name": string,
"email": string,
"status": string,
"role": string,
"time_zone": string,
"last_login": string,
"created_at": string,
"updated_at": string
}
}
update_user
更新用户信息。
参数:
{
"id": number,
"name": string,
"email": string,
"role": string,
"time_zone": string
}
返回值:
{
"user": {
"id": number,
"name": string,
"email": string,
"status": string,
"role": string,
"time_zone": string,
"last_login": string,
"created_at": string,
"updated_at": string
}
}
delete_user
删除用户。
参数:
{
"id": number
}
时间卡片相关接口
get_timecards
获取所有时间卡片记录。
参数:
{
"user_id": number,
"start_date": string,
"end_date": string,
"status": string,
"page": number,
"limit": number
}
返回值:
{
"timecards": [],
"total_pages": number,
"current_page": number
}
get_timecard
根据 ID 获取单个时间卡片记录。
参数:
{
"id": number
}
返回值:
{
"timecard": {
"id": number,
"user_id": number,
"date": string,
"start_time": string,
"end_time": string,
"duration": number,
"status": string,
"notes": string,
"created_at": string,
"updated_at": string
}
}
create_timecard
创建新的时间卡片记录。
参数:
{
"user_id": number,
"date": string,
"start_time": string,
"end_time": string,
"duration": number,
"status": string,
"notes": string
}
返回值:
{
"timecard": {
"id": number,
"user_id": number,
"date": string,
"start_time": string,
"end_time": string,
"duration": number,
"status": string,
"notes": string,
"created_at": string,
"updated_at": string
}
}
update_timecard
更新时间卡片记录。
参数:
{
"id": number,
"user_id": number,
"date": string,
"start_time": string,
"end_time": string,
"duration": number,
"status": string,
"notes": string
}
返回值:
{
"timecard": {
"id": number,
"user_id": number,
"date": string,
"start_time": string,
"end_time": string,
"duration": number,
"status": string,
"notes": string,
"created_at": string,
"updated_at": string
}
}
delete_timecard
删除时间卡片记录。
参数:
{
"id": number
}
报告相关接口
generate_payroll_report
生成 payroll 报告。
参数:
{
"start_date": string,
"end_date": string,
"user_id": number,
"department": string,
"status": string
}
返回值:
{
"report": {
"id": number,
"start_date": string,
"end_date": string,
"total_hours": number,
"total_overtime": number,
"subtotal": number,
"taxes": number,
"grand_total": number,
"created_at": string
}
}
generate_project_report
生成项目报告。
参数:
{
"project_id": number,
"start_date": string,
"end_date": string,
"user_id": number,
"status": string
}
返回值:
{
"report": {
"id": number,
"project_id": number,
"start_date": string,
"end_date": string,
"total_hours": number,
"subtotal": number,
"grand_total": number,
"created_at": string
}
}
自定义字段相关接口
get_custom_fields
获取所有自定义字段。
参数:
{
"page": number,
"limit": number
}
返回值:
{
"custom_fields": [],
"total_pages": number,
"current_page": number
}
get_custom_field
根据 ID 获取单个自定义字段。
参数:
{
"id": number
}
返回值:
{
"custom_field": {
"id": number,
"name": string,
"type": string,
"required": boolean,
"options": array,
"created_at": string,
"updated_at": string
}
}
create_custom_field
创建新的自定义字段。
参数:
{
"name": string,
"type": string,
"required": boolean,
"options": array
}
返回值:
{
"custom_field": {
"id": number,
"name": string,
"type": string,
"required": boolean,
"options": array,
"created_at": string,
"updated_at": string
}
}
update_custom_field
更新自定义字段。
参数:
{
"id": number,
"name": string,
"type": string,
"required": boolean,
"options": array
}
返回值:
{
"custom_field": {
"id": number,
"name": string,
"type": string,
"required": boolean,
"options": array,
"created_at": string,
"updated_at": string
}
}
delete_custom_field
删除自定义字段。
参数:
{
"id": number
}
对象修改状态相关接口
get_last_modified
获取指定对象的最后修改时间。
参数:
{
"object_type": string,
"object_id": number
}
返回值:
{
"last_modified_at": string
}
系统管理相关接口
backup_system
备份系统数据。
无请求参数。
返回值:
{
"status": string,
"message": string
}
restore_system
恢复系统数据。
无请求参数。
返回值:
{
"status": string,
"message": string
}
快速开始
要在项目中使用此 API,请按照以下步骤操作:
- 安装依赖:
npm install quickbooks-node
- 初始化客户端:
const QuickBooks = require('quickbooks-node');
const qb = new QuickBooks({
consumerKey: 'your_consumer_key',
consumerSecret: 'your_consumer_secret',
accessToken: 'your_access_token',
accessTokenSecret: 'your_access_secret'
});
- 使用 API 方法:
qb.users.get()
.then(user => {
console.log('Logged in as:', user.name);
})
.catch(err => {
console.error('Error:', err);
});
文档
有关更多详细信息,请参阅 QuickBooks API 文档。
许可证
MIT License
贡献者
贡献者列表: