(accounting.expenses)
- list - List Expenses
- create - Create Expense
- get - Get Expense
- update - Update Expense
- delete - Delete Expense
List Expenses
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const result = await apideck.accounting.expenses.list({
raw: false,
serviceId: "salesforce",
limit: 20,
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { accountingExpensesList } from "@apideck/unify/funcs/accountingExpensesList.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const res = await accountingExpensesList(apideck, {
raw: false,
serviceId: "salesforce",
limit: 20,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.AccountingExpensesAllRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountingExpensesAllResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequestResponse | 400 | application/json |
errors.UnauthorizedResponse | 401 | application/json |
errors.PaymentRequiredResponse | 402 | application/json |
errors.NotFoundResponse | 404 | application/json |
errors.UnprocessableResponse | 422 | application/json |
errors.APIError | 4XX, 5XX | */* |
Create Expense
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const result = await apideck.accounting.expenses.create({
raw: false,
serviceId: "salesforce",
expense: {
number: "OIT00546",
transactionDate: new Date("2021-05-01T12:00:00.000Z"),
accountId: "123456",
customerId: "12345",
supplierId: "12345",
companyId: "12345",
departmentId: "12345",
paymentType: "cash",
currency: "USD",
currencyRate: 0.69,
type: "expense",
memo: "For travel expenses incurred on 2024-05-15",
taxRate: {
id: "123456",
rate: 10,
},
totalAmount: 275,
lineItems: [
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
],
customFields: [
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: "Uses Salesforce and Marketo",
},
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: "Uses Salesforce and Marketo",
},
],
rowVersion: "1-12345",
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { accountingExpensesCreate } from "@apideck/unify/funcs/accountingExpensesCreate.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const res = await accountingExpensesCreate(apideck, {
raw: false,
serviceId: "salesforce",
expense: {
number: "OIT00546",
transactionDate: new Date("2021-05-01T12:00:00.000Z"),
accountId: "123456",
customerId: "12345",
supplierId: "12345",
companyId: "12345",
departmentId: "12345",
paymentType: "cash",
currency: "USD",
currencyRate: 0.69,
type: "expense",
memo: "For travel expenses incurred on 2024-05-15",
taxRate: {
id: "123456",
rate: 10,
},
totalAmount: 275,
lineItems: [
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
],
customFields: [
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: "Uses Salesforce and Marketo",
},
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: "Uses Salesforce and Marketo",
},
],
rowVersion: "1-12345",
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.AccountingExpensesAddRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountingExpensesAddResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequestResponse | 400 | application/json |
errors.UnauthorizedResponse | 401 | application/json |
errors.PaymentRequiredResponse | 402 | application/json |
errors.NotFoundResponse | 404 | application/json |
errors.UnprocessableResponse | 422 | application/json |
errors.APIError | 4XX, 5XX | */* |
Get Expense
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const result = await apideck.accounting.expenses.get({
id: "<id>",
serviceId: "salesforce",
raw: false,
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { accountingExpensesGet } from "@apideck/unify/funcs/accountingExpensesGet.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const res = await accountingExpensesGet(apideck, {
id: "<id>",
serviceId: "salesforce",
raw: false,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.AccountingExpensesOneRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountingExpensesOneResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequestResponse | 400 | application/json |
errors.UnauthorizedResponse | 401 | application/json |
errors.PaymentRequiredResponse | 402 | application/json |
errors.NotFoundResponse | 404 | application/json |
errors.UnprocessableResponse | 422 | application/json |
errors.APIError | 4XX, 5XX | */* |
Update Expense
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const result = await apideck.accounting.expenses.update({
id: "<id>",
serviceId: "salesforce",
raw: false,
expense: {
number: "OIT00546",
transactionDate: new Date("2021-05-01T12:00:00.000Z"),
accountId: "123456",
customerId: "12345",
supplierId: "12345",
companyId: "12345",
departmentId: "12345",
paymentType: "cash",
currency: "USD",
currencyRate: 0.69,
type: "expense",
memo: "For travel expenses incurred on 2024-05-15",
taxRate: {
id: "123456",
rate: 10,
},
totalAmount: 275,
lineItems: [
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
],
customFields: [
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: true,
},
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: {},
},
],
rowVersion: "1-12345",
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { accountingExpensesUpdate } from "@apideck/unify/funcs/accountingExpensesUpdate.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const res = await accountingExpensesUpdate(apideck, {
id: "<id>",
serviceId: "salesforce",
raw: false,
expense: {
number: "OIT00546",
transactionDate: new Date("2021-05-01T12:00:00.000Z"),
accountId: "123456",
customerId: "12345",
supplierId: "12345",
companyId: "12345",
departmentId: "12345",
paymentType: "cash",
currency: "USD",
currencyRate: 0.69,
type: "expense",
memo: "For travel expenses incurred on 2024-05-15",
taxRate: {
id: "123456",
rate: 10,
},
totalAmount: 275,
lineItems: [
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
{
trackingCategories: [
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
{
id: "123456",
name: "New York",
},
],
accountId: "123456",
customerId: "12345",
departmentId: "12345",
locationId: "12345",
taxRate: {
id: "123456",
rate: 10,
},
description: "Travel US.",
totalAmount: 275,
billable: true,
},
],
customFields: [
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: true,
},
{
id: "2389328923893298",
name: "employee_level",
description: "Employee Level",
value: {},
},
],
rowVersion: "1-12345",
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.AccountingExpensesUpdateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountingExpensesUpdateResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequestResponse | 400 | application/json |
errors.UnauthorizedResponse | 401 | application/json |
errors.PaymentRequiredResponse | 402 | application/json |
errors.NotFoundResponse | 404 | application/json |
errors.UnprocessableResponse | 422 | application/json |
errors.APIError | 4XX, 5XX | */* |
Delete Expense
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const result = await apideck.accounting.expenses.delete({
id: "<id>",
serviceId: "salesforce",
raw: false,
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { accountingExpensesDelete } from "@apideck/unify/funcs/accountingExpensesDelete.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
apiKey: process.env["APIDECK_API_KEY"] ?? "",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});
async function run() {
const res = await accountingExpensesDelete(apideck, {
id: "<id>",
serviceId: "salesforce",
raw: false,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.AccountingExpensesDeleteRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountingExpensesDeleteResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequestResponse | 400 | application/json |
errors.UnauthorizedResponse | 401 | application/json |
errors.PaymentRequiredResponse | 402 | application/json |
errors.NotFoundResponse | 404 | application/json |
errors.UnprocessableResponse | 422 | application/json |
errors.APIError | 4XX, 5XX | */* |