Import Expense Transactions
Expense Transaction Import Guide
The Expense Transaction Import module allows you to import expense records into the system efficiently. Before using this feature, ensure that the API Site user has proxy access to the records' owner. Without this setup, API calls will fail.
Proxy Access Prerequisites
To configure proxy access, follow these steps in the correct order:
-
Create an Employee Record:
- In the DATABASICS Admin module, create an employee with an ID that matches the desired API Site user ID. For example, create an employee with the ID
APIUSER
.
- In the DATABASICS Admin module, create an employee with an ID that matches the desired API Site user ID. For example, create an employee with the ID
-
Grant Proxy Access:
- Assign proxy access to the employee (
APIUSER
) for the user(s) whose expense records will be imported.
- Assign proxy access to the employee (
-
Create the API Site User:
- Set up an API Site user in DATABASICS Admin with the same ID as the employee created in Step 1 (
APIUSER
).
- Set up an API Site user in DATABASICS Admin with the same ID as the employee created in Step 1 (
-
Use the API Site User for Import:
- Use this API Site user to perform API calls and import expense transactions.
Note: Follow these steps in sequence to avoid proxy access errors.
Get Expense Import List
The getExpenseImportList
API retrieves a list of expense records from the import utility based on their processing status. This call allows you to filter records, such as those with a "new" status, for further action.
Request Header
Include the API key in the request header to authenticate the call:
{
"Content-Type": "application/json",
"api-key": "your_api_key"
}
Parameters
Use the following parameter to specify the load status of the records to retrieve:
{
"loadStatus": "N" // Load status: "N" for New, "P" for Posted, "W" for Warning, "I" for Information, "E" for Error.
}
Example Request
GET https://api.data-basics.net/apihub/apis/getExpenseImportList?loadStatus=N
Insert New Expense Records
The expenseImportNew
API allows you to insert new expense records into the system. Use this endpoint to save and optionally import new entries with detailed parameters, such as employee ID, travel date, expense type, and work breakdown structure (WBS) codes.
Request Header
Include the API key in the request header to authenticate the call:
{
"Content-Type": "application/json",
"api-key": "your_api_key"
}
Parameters
Below is a list of parameters for the expenseImportNew
call with their descriptions:
{
"isImport": "N", // Controls action after save. N = Save as New without import, Y = Automatically import.
"emplyId": "JDOE", // Employee ID.
"trevalDate": "2022-01-06",// Travel date associated with the expense.
"hdrTitle": "test", // Header title for the expense report.
"requireCharges": "R", // Required charges: R = Required, N = Not Required.
"reportType": "DATEF", // Report type for the expense.
"currencyFrom": "USD", // Currency used for the expense.
"totalAmount": 2, // Total amount of the expense.
"expType": "AIRFARE", // Expense type (e.g., AIRFARE, LODGING, MEALS).
"payId": "PT_CASH", // Payment method ID.
"fieldValue1": "a", // Custom field value 1.
"fieldValue2": "b", // Custom field value 2.
"fieldValue3": "c", // Custom field value 3.
"fieldValue4": "d", // Custom field value 4.
"fieldValue5": "e", // Custom field value 5.
"expCode": "DIRECT", // Expense code.
"level1Code": "A", // WBS Level 1 Code (max size: 20 characters).
"level2Code": "B", // WBS Level 2 Code (max size: 20 characters).
"level3Code": "C", // WBS Level 3 Code (max size: 20 characters).
"level4Code": "D", // WBS Level 4 Code (max size: 20 characters).
"optCode": "0002", // Operation Unit Code (max size: 20 characters).
"deptCode": "000000", // Department Code.
"note": "test", // Notes associated with the expense.
"batchId": "d", // Batch ID for grouping entries in a single import call.
"dbHdrStatus": "H" // Expense status once imported:
// H = Draft, R = Release, P = In approval Process, X = Open by Proxy, O = Open by Owner.
}
Example Request
POST https://api.data-basics.net/apihub/apis/expenseImportNew
Request Body:
{
"isImport": "N",
"emplyId": "JDOE",
"trevalDate": "2022-01-06",
"hdrTitle": "test",
"requireCharges": "R",
"reportType": "DATEF",
"currencyFrom": "USD",
"totalAmount": 2,
"expType": "AIRFARE",
"payId": "PT_CASH",
"fieldValue1": "a",
"fieldValue2": "b",
"fieldValue3": "c",
"fieldValue4": "d",
"fieldValue5": "e",
"expCode": "DIRECT",
"level1Code": "A",
"level2Code": "B",
"level3Code": "C",
"level4Code": "D",
"optCode": "0002",
"deptCode": "000000",
"note": "test",
"batchId": "d",
"dbHdrStatus": "H"
}
Import Expense Records into the System
The expenseImportAll
API processes expense records from the import utility and moves them into the live system. You can use this call to import all new records or filter them based on a specific batch ID.
Request Header
Include the API key in the request header to authenticate the call:
{
"Content-Type": "application/json",
"api-key": "your_api_key"
}
Parameters
Use the following parameters to specify the action to be performed:
{
"actionFlag": "A", // Import Action:
// A = Import all rows with 'N' (New) status.
// B = Import all rows with a matching batchId and 'N' (New) status.
"batchId": "d" // Batch ID: Required if actionFlag = 'B'. Only records with this batchId and loadStatus = N will be processed.
}
Example Request
POST https://api.data-basics.net/apihub/apis/expenseImportAll
Request Body:
{
"actionFlag": "A",
"batchId": "d"
}
When to Use Each Action
-
actionFlag: A
(Import All) :
Use this option to import all rows in the import utility that are marked withN
(New) status. -
actionFlag: B
(Import by Batch) :
Use this option to limit the import to records with a specific batch ID. Only rows with the specifiedbatchId
andN
(New) status will be processed.
Response
The response will include details about the success or failure of the import operation, along with messages for any warnings or errors encountered during the process.
Updated 4 months ago