Api/Expenses/Add adds new expense to Expenses module.
- You need access to Expenses module. If you don't have it, please ask it from your sales manager.
- API user must have access to:
- Expenses module
- Expenses - allow editing of expenses permission
Bold fields are mandatory, other ones optional:
Api/Expenses/add (fuelCardNumber, timestamp, productType, provider, amount, sum, nettoSum, receiptNumber, comment)
fuelCardNumber: system looks for fuel card numbers, what are inserted to settings - vehicles - fuel card number field, and tries to match expense with car using that field
timestamp: date and time, when expense occurred. Should be in format YYYY-MM-DD [HH:mm:[SS]] (if parts of time are skipped or omitted, zeros are used instead).
productType: specifies, what type your expense is. If you leave it empty, special system type Fuel is used. See separate section below.
provider: you can use it for any purpose, to point out, who made that expense. Usually it contains filling station name, like "Lukoil", "Olerex" etc.
amount: amount or volume of product type, like fuel amount in litres
sum: sum of expense with VAT (Value Added Tax)
nettoSum: sum of expense without VAT
receiptNumber: add this, if you want receiptNumber to be together with expense
comment: any additional text, what describes that expense
Under FC+ - settings - categories - expense types, there is list of currently defined expense types. There is at least one predefined system type, Fuel, what marks all sorts of fuel types, like diesel and gasoline. Lots of reports look for only expenses, what have Fuel type, so for all fuel-related types, you should use this type.
General algorithm for using
- is it empty? Then use Fuel type
- does it match with already defined expense types? Then return ID of one of those types
- none above: create new expense type and return its ID
If adding expense is successful, <response/> contains following items:
id: unique number of expense. Ask it with
objectId: unique number of object, what is same what we get with
typeId: returns ID of expense product type
amount: amount or volume of expense, like fuel in litres
sum: sum with VAT
nettoSum: sum without VAT
provider: free text, what is usually filled on manual import, and may contain text like "Lukoil", "Circle-K" etc.
comment: free text describing that expense
timeStamp: exact time of that expense
Api/Expenses/add?key=apidemo-NJ8V7PENgkau5FYH& fuelCardNumber=1234& timestamp=2020-12-17 16:00& productType=Fuel& provider=Olerex& amount=50& sum=52& nettoSum=41.60& receiptNumber=12345678& comment=daily filling
If you get any error messages, here are some possible messages and solutions:
- "No permissions": API user needs access to expenses module, and to expenses/allow editing of expenses permission
- "Unknown fuel card number": there is no such vehicle, what has this fuel card number