Blame

6874e1 Hargata Softworks 2024-01-29 01:25:19 1
# API
2
640330 Hargata Softworks 2024-02-09 22:02:40 3
LubeLogger provides API endpoints to retrieve and add records, full documentation of these endpoints can be found at `/api`.
6874e1 Hargata Softworks 2024-01-29 01:25:19 4
5
## Authentication
6
If authentication is enabled, it implements Basic Auth based on RFC2617, which stipulates that the "token" is passed in as a Base64-encoded string comprising of a username and password separated by a colon(":"). Because of this, neither the username nor password can contain a colon(":") character.
7
0878ff Hargata Softworks 2025-02-03 16:42:35 8
### In-line URL Authorization
9
In-line authorization is supported as of 1.4.3 as it is necessary for authorization for the calendar endpoint. Use it as so:
10
d0c66f Hargata Softworks 2025-02-03 16:43:13 11
`https://username:password@lubeloggerdomain/api/endpoint`
12
13
For the calendar endpoint, it will look something like this:
14
15
`https://test:1234@demo.lubelogger.com/api/calendar`
0878ff Hargata Softworks 2025-02-03 16:42:35 16
c74580 Hargata Softworks 2024-12-31 15:52:38 17
## POST/PUT Encoding
18
As of 1.4.2, LubeLogger supports bodies in both form-data, x-www-form-urlencoded, and JSON format.
19
20
Note that form-data and x-www-form-urlencoded will always convert any data into strings even if you are passing in a number. Post bodies in JSON if you wish to pass in numbers and integers.
21
22
## Locale-Invariant Formatting
23
By default, LubeLogger will return all data as strings for GET methods and it is locale-sensitive:
24
25
![](/Advanced/API/a/image-1735660075138.png)
26
27
Note the date and decimal formatting.
28
29
If you wish for locale invariant and type-rich formatting(numbers are returned as numbers instead of string), you can either inject the following environment variable:
30
31
`LUBELOGGER_INVARIANT_API=true`
32
33
Or add the following Header Key in your API request:
34
35
`culture-invariant`
36
37
No values are needed, the presence of the key is sufficient for LubeLogger to format the API response:
38
39
![](/Advanced/API/a/image-1735660354711.png)
40
cbbc81 Hargata Softworks 2025-08-18 17:32:11 41
## GET Parameters
42
As of 1.4.8, you can now pass in additional parameters to filter down results from the following GET API endpoints:
43
44
- Plan
45
- Odometer
46
- Service Record
47
- Repair
48
- Upgrade
49
- Fuel
50
- Tax
51
52
The parameters that you can pass in are:
53
54
```
55
Id: Id of the record
56
StartDate: Find records after this date (not inclusive)
57
EndDate: Find records before this date (not inclusive)
58
Tags: Find records that contains these tags(separated by white space, not applicable to Plans)
59
```
60
61
![](/Advanced/API/a/image-1755538298273.png)
62
5dbeb0 Hargata Softworks 2025-09-09 13:54:04 63
## Cleaning up Temp/Unlinked Files
64
The clean up endpoint: `/api/cleanup` will clear up any temp files created by LubeLogger. Adding the `deepClean=true` parameter will also clear out any unlinked attachments(files where the record it is associated with no longer exists). You need to have access to the root user credentials to access this endpoint.
cbbc81 Hargata Softworks 2025-08-18 17:32:11 65
368fc6 Hargata Softworks 2024-12-31 15:53:21 66
## Testing
6874e1 Hargata Softworks 2024-01-29 01:25:19 67
You can utilize any REST API testing tool to test your use-case.
68
3d05a7 Hargata Softworks 2024-12-10 15:18:18 69
[Postman Collection](https://github.com/hargata/lubelog_scripts/blob/main/misc/LubeLogger.postman_collection.json)
70
6874e1 Hargata Softworks 2024-01-29 01:25:19 71
## Example Use Cases
72
- Send Email Reminders, see [[Reminders|Records/Reminders#reminder-emails]]
73
- Insert Odometer Records, see [[Odometer|Records/Odometer#api-integration]]
3df82f Hargata Softworks 2024-04-19 03:21:58 74
- Create DB Backups, [Example BASH Script](https://github.com/hargata/lubelog_scripts/blob/main/bash/makebackup.sh) [Example DOS Script](https://github.com/hargata/lubelog_scripts/blob/main/dos/makebackup.bat)