xero-accounting-sdk
v1.0.0
Published
Xero's Accounting API that contains all the endpoints for managing accounting operations including accounts, attachments, batch payments, bank transactions, and other financial data.
Readme
Getting Started with Xero
Introduction
All the endpoints on the Accounting API.
To make requests you'll need a valid access_token and xero-tenant-id in your environment variables. These can be set by following the steps in the Xero OAuth2.0 collection.
Note: access tokens expire after 30 minutes but can be refreshed using the POST Refresh token request in the Xero OAuth2.0 collection.
Install the Package
Run the following command from your project directory to install the package from npm:
npm install [email protected]For additional package details, see the Npm page for the [email protected] npm.
Test the SDK
To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
npm run testOr you can also run tests with coverage report:
npm run test:coverageInitialize the API Client
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| environment | Environment | The API environment. Default: Environment.Production |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
| implicitAuthCredentials | ImplicitAuthCredentials | The credential object for implicitAuth |
The API client can be initialized as follows:
import { Client, Environment } from 'xero-accounting-sdk';
const client = new Client({
implicitAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthRedirectUri: 'OAuthRedirectUri'
},
timeout: 0,
environment: Environment.Production,
});Authorization
This API uses the following authentication schemes.
List of APIs
- File Name
- Account ID
- Batch Payment ID History
- Batch Payments
- Bank Transaction ID
- Bank Transactions
- Bank Transfer ID
- Bank Transfers
- Payment Services
- Branding Theme ID
- Branding Themes
- Contact ID
- Contact Group ID
- Contact Groups
- Credit Note ID
- Credit Notes
- Expense Claim ID
- Expense Claims
- Invoice ID
- Item ID
- Linked Transaction ID
- Linked Transactions
- Manual Journal ID
- Manual Journals
- Overpayment ID
- Payment ID
- Prepayment ID
- Purchase Order ID
- Purchase Orders
- Quote ID
- Receipt ID
- Repeating Invoice ID
- Repeating Invoices
- Tax Rates
- Tracking Option ID
- Tracking Category ID
- Tracking Categories
- Attachments
- Accounts
- History
- Contacts
- Currencies
- Employees
- Invoices
- Items
- Journals
- Organisation
- Overpayments
- Payments
- Prepayments
- Quotes
- Receipts
- Reports
- Options
- Users
- Misc
