@commenda-integrations/rootfi-api

中文文档
3.2.3发布于 2026/05/20MITTypeScriptCommonJS近 30 天下载 7839

Commenda Integrations API

原始使用文档
文档目录11 节
  1. Documentation
  2. Installation
  3. Instantiation
  4. Namespaces
  5. Usage
  6. Get Invoices
  7. Get Orders
  8. Get Companies
  9. Paginate Data
  10. Create Account
  11. Sample Code for Fetching and Saving Data

RootFi Node Library

The RootFi Node.js library provides convenient access to the RootFi API from applications written in server-side JavaScript.

Documentation

See the API docs for more information about the API.

Installation

npm install --save rootfi-api
# or
yarn add rootfi-api

Instantiation

import { RootFiClient } from "rootfi-api";

const rootfi = new RootFiClient({
    apiKey: "ROOTFI_API_KEY",
});

Namespaces

The RootFi SDK is organized into categories, each with its own namespace. The available categories are:

  • core: APIs for managing companies and invite links
  • accounting: APIs for managing invoices, bills, and other accounting-related data
  • ecommerce: APIs for managing orders, products, and other e-commerce-related data
  • payments: APIs for managing payments and other payment-related data
  • crm: APIs for managing customers and other CRM-related data

const rootfi = new RootFiClient({
  apiKey: 'ROOTFI_API_KEY',
});

rootfi.accounting. // APIs specific to the Accounting Category

rootfi.payments. // APIs specific to the Payments Category

Usage

Below are code snippets of how you can use the RootFi Typescript SDK.

Get Invoices

import { RootFiClient } from "rootfi-api";

const rootfi = new RootFiClient({ apiKey: "ROOTFI_API_KEY" });

invoices = await rootfi.accounting.invoices.list({ limit: 10, rootfiCompanyID: 234 });

Get Orders

import { RootFiClient } from "rootfi-api";

const rootfi = new RootFiClient({ apiKey: "ROOTFI_API_KEY" });

orders = await rootfi.ecommerce.orders.list({ limit: 10, rootfiCompanyID: 234 });

Get Companies

import { RootFiClient } from "rootfi-api";

const rootfi = new RootFiClient({ apiKey: "ROOTFI_API_KEY" });

const companies = await rootfi.core.companies.list({ limit: 10 });

Paginate Data

RootFi follows cursor-based pagination. The response will include a next and prev property. To get the next page, you can pass in the value of next to the cursor property on the request. Similarly, to get the previous page, you can pass in the value of prev to the cursor property on the request.

import { RootFiClient } from "rootfi-api";

const rootfi = new RootFiClient({ apiKey: "ROOTFI_API_KEY" });

const orders = await rootfi.ecommerce.orders.list({
    limit: 10,
    rootfiCompanyID: 234,
    next: "eyJyb290ZmlfaWQiOjE4ODA2MDZ9",
});

Create Account

import { RootFiClient } from "rootfi-api";

const rootfi = new RootFiClient({ apiKey: "ROOTFI_API_KEY" });

await rootfi.core.inviteLinks.create({
    company_name: "Test Company",
    integration_category: ["ACCOUNTING"],
});

Sample Code for Fetching and Saving Data

Below is a sample code for fetching and saving data from the RootFi API to your database. You can use this as a starting point to build your own data sync process.

import { RootFiClient } from "rootfi-api";
const rootfi = new RootFiClient({ apiKey: "ROOTFI_API_KEY" });

async function fetchAllData() {
    let nextCursor = null;

    do {
        const response = await rootfi.accounting.invoices.list({ next: nextCursor, limit: 100 });
        const data = response.data;

        // Save data to your database

        nextCursor = response.next;
    } while (nextCursor);
}

版本与发布记录

@commenda-integrations/rootfi-api 共发布 1 个版本,首次发布于 2026/05/20;过去 12 个月发布了 1 个版本。

版本发布日期距今
3.2.3latest2026/05/205 个月前

关于 @commenda-integrations/rootfi-api 的常见问题

@commenda-integrations/rootfi-api 是什么?

Commenda Integrations API

如何安装 @commenda-integrations/rootfi-api?

在项目目录运行 npm install @commenda-integrations/rootfi-api,或使用 pnpm add / yarn add / bun add。

@commenda-integrations/rootfi-api 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@commenda-integrations/rootfi-api 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@commenda-integrations/rootfi-api 可以商用吗?

@commenda-integrations/rootfi-api 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@commenda-integrations/rootfi-api 的下载量有多少?

根据 npm 官方下载统计,@commenda-integrations/rootfi-api 在 2026/10/11 – 2026/11/09 这 30 天内被下载 7,839 次,日均约 261 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@commenda-integrations/rootfi-api 还在维护吗?

最新版本 3.2.3 发布于 2026/05/20(5 个月前);至今共发布 1 个版本,其中过去 12 个月发布了 1 个;首次发布于 2026/05/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。