Welcome to the Softledger SDK documentation. This guide will help you get started with integrating and using the Softledger SDK in your project.
- API version:
1.0.0
- SDK version:
0.5.0
SoftLedger General Ledger Accounting API
This SDK is compatible with the following versions: TypeScript >= 4.8.4
To get started with the SDK, we recommend installing using npm
:
npm install @softledger/node
The Softledger API uses OAuth for authentication.
You need to provide the OAuth parameters when initializing the SDK.
const sdk = new Softledger({ clientId: 'CLIENT_ID', clientSecret: 'CLIENT_SECRET' });
If you need to set or update the OAuth parameters after the SDK initialization, you can use:
const sdk = new Softledger();
sdk.clientId = 'CLIENT_ID';
sdk.clientSecret = 'CLIENT_SECRET';
You can set a custom timeout for the SDK's HTTP requests as follows:
const softledger = new Softledger({ timeout: 10000 });
Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:
import { AddressFilter, FilterOptions, Softledger } from '@softledger/node';
(async () => {
const softledger = new Softledger({
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
});
const equals = 'fugiat ';
const not = 'sint in eu tem';
const gt = 'culpa pariatu';
const gte = 'nisi ea D';
const lt = 'conseq';
const lte = 'non q';
const filterOptionsIn = 'irure anim al';
const filterOptions: FilterOptions = {
equals: equals,
contains: 'contains',
not: not,
gt: gt,
gte: gte,
lt: lt,
lte: lte,
in: [filterOptionsIn],
isNull: true,
};
const addressFilter: AddressFilter = {
_id: filterOptions,
label: filterOptions,
line1: filterOptions,
line2: filterOptions,
city: filterOptions,
state: filterOptions,
zip: filterOptions,
country: filterOptions,
isDefault: filterOptions,
isVerified: filterOptions,
createdAt: filterOptions,
updatedAt: filterOptions,
CustomerId: filterOptions,
VendorId: filterOptions,
};
const addressesSearchFilterType = 'all';
const addressesSearchOrder = '_id:ASC';
const { data } = await softledger.addresses.addressesSearch({
filter: addressFilter,
filterType: addressesSearchFilterType,
cursor: 'cursor',
limit: 25,
order: addressesSearchOrder,
});
console.log(data);
})();
The SDK provides various services to interact with the API.
Below is a list of all available services with links to their detailed documentation:
The SDK includes several models that represent the data structures used in API requests and responses. These models help in organizing and managing the data efficiently.