Create Bulk Expenses
Description:
The /expense/bulk
endpoint allows creation of multiple expense records simultaneously.
Method:
POST
Request Payload:
Parameter | Type | Description |
---|---|---|
expenses | array | Array of expense objects |
curl --request POST \
--url https://server26-dot-royalti-project.uc.r.appspot.com/expense/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"expenses": [
{
"title": "Expense for Ladipoe",
"transactionDate": "2023-03-14",
"type": "artist",
"currency": "USD",
"amount": 100,
"amountUSD": 100,
"artist": "ladipoe",
"conversionRate": 1,
"memo": "Expense memo for ladipoe",
"files": [
"file1.jpg",
"file2.jpg"
]
},
{
"title": "Expense for Another Mavins Product",
"transactionDate": "2023-03-13",
"type": "product",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"product": "Another mavins Product",
"memo": "Expense memo for arya star",
"files": [
"file3.jpg",
"file4.jpg"
]
},
{
"title": "Expense for asset feeling",
"transactionDate": "2023-03-13",
"type": "asset",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"asset": "feeling-asset-id",
"memo": "Expense memo for feeling asset",
"files": [
"file5.jpg",
"file6.jpg"
]
}
]
}'
{
"message": "Bulk expense creation completed",
"createdExpenses": [
"Expense One",
"Expense Two"
],
"processedCount": 3,
"totalAmount": 500,
"totalAmountUSD": 540,
"errors": [
"Invalid currency for Expense Three"
]
}
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Created with possible errors
The response is of type object
.
curl --request POST \
--url https://server26-dot-royalti-project.uc.r.appspot.com/expense/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"expenses": [
{
"title": "Expense for Ladipoe",
"transactionDate": "2023-03-14",
"type": "artist",
"currency": "USD",
"amount": 100,
"amountUSD": 100,
"artist": "ladipoe",
"conversionRate": 1,
"memo": "Expense memo for ladipoe",
"files": [
"file1.jpg",
"file2.jpg"
]
},
{
"title": "Expense for Another Mavins Product",
"transactionDate": "2023-03-13",
"type": "product",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"product": "Another mavins Product",
"memo": "Expense memo for arya star",
"files": [
"file3.jpg",
"file4.jpg"
]
},
{
"title": "Expense for asset feeling",
"transactionDate": "2023-03-13",
"type": "asset",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"asset": "feeling-asset-id",
"memo": "Expense memo for feeling asset",
"files": [
"file5.jpg",
"file6.jpg"
]
}
]
}'
{
"message": "Bulk expense creation completed",
"createdExpenses": [
"Expense One",
"Expense Two"
],
"processedCount": 3,
"totalAmount": 500,
"totalAmountUSD": 540,
"errors": [
"Invalid currency for Expense Three"
]
}