API
ezBookkeeping provides HTTP API for the frontend interface, and these API can also be used directly by users to implement more automation functions. Please note that the ezBookkeeping HTTP API is not intended for regular users, and the information in this document may not be comprehensive. For more information, please refer to the source code.
Usage
The API of ezBookkeeping verifies user identity by tokens. You can enable the option to generate API tokens by updating enable_api_token in the configuration file or by setting the environment variable. For details, see Configuration. After enabled, the "Generate Token" button will appear on "User Settings" -> "Security" page in the desktop version, and you can also generate the token by the user-session-new command in ezBookkeeping's CLI, for more details, see the Command Line.
Then you can use the token to access the API.
$ curl -H "Authorization: Bearer ${TOKEN}" "http://${YOUR_HOST_ADDRESS}/api/v1/${API_PATH}"The response of API is JSON object like the following:
Successful response
{
"result": ..., // The acutal data
"success": true
}Failed response
{
"errorCode": xxxxxx, // The error code
"errorMessage": "xxx", // The error message
"path": "/api/v1/{API_PATH}", // The API full path
"success": false
}