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 | ||||
c74580 | Hargata Softworks | 2024-12-31 15:52:38 | 8 | ## POST/PUT Encoding |
9 | As of 1.4.2, LubeLogger supports bodies in both form-data, x-www-form-urlencoded, and JSON format. | |||
10 | ||||
11 | 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. | |||
12 | ||||
13 | ## Locale-Invariant Formatting | |||
14 | By default, LubeLogger will return all data as strings for GET methods and it is locale-sensitive: | |||
15 | ||||
16 | ![](/Advanced/API/a/image-1735660075138.png) | |||
17 | ||||
18 | Note the date and decimal formatting. | |||
19 | ||||
20 | 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: | |||
21 | ||||
22 | `LUBELOGGER_INVARIANT_API=true` | |||
23 | ||||
24 | Or add the following Header Key in your API request: | |||
25 | ||||
26 | `culture-invariant` | |||
27 | ||||
28 | No values are needed, the presence of the key is sufficient for LubeLogger to format the API response: | |||
29 | ||||
30 | ![](/Advanced/API/a/image-1735660354711.png) | |||
31 | ||||
368fc6 | Hargata Softworks | 2024-12-31 15:53:21 | 32 | ## Testing |
6874e1 | Hargata Softworks | 2024-01-29 01:25:19 | 33 | You can utilize any REST API testing tool to test your use-case. |
34 | ||||
3d05a7 | Hargata Softworks | 2024-12-10 15:18:18 | 35 | [Postman Collection](https://github.com/hargata/lubelog_scripts/blob/main/misc/LubeLogger.postman_collection.json) |
36 | ||||
6874e1 | Hargata Softworks | 2024-01-29 01:25:19 | 37 | ## Example Use Cases |
38 | - Send Email Reminders, see [[Reminders|Records/Reminders#reminder-emails]] | |||
39 | - Insert Odometer Records, see [[Odometer|Records/Odometer#api-integration]] | |||
3df82f | Hargata Softworks | 2024-04-19 03:21:58 | 40 | - 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) |