Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API

StrichRListe API (0.11.0)

AGPL-3.0-or-later

StrichRListe API to access all functions of the server Base path of all api functionality is located at /api


Paths

GET /

Info

Response at the root level of the api

Responses
  • 200: string (text/plain)

GET /article

Get all articles

Responses
  • 200: Article (application/json)
  • 500: string (text/plain)

POST /article

Create article

Request

CreateArticle (application/json)

Responses
  • 201: Article (application/json)
  • 500: string (text/plain)

GET /article/label/{label}

Get articles by label

Responses
  • 200: array of Article (application/json)
  • 500: string (text/plain)

GET /article/search/{term}

Search article

Responses
  • 200: array of Article (application/json)
  • 500: string (text/plain)

GET /article/{article}/compensation

Get all compensations for a specific article

Responses
  • 200: Compensation (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

POST /article/{article}/compensation

Compensate Inventory

Request

CreateCompensation (application/json)

Responses
  • 201: Compensation (application/json)
  • 400: string (text/plain)
  • 404: string (text/plain)
  • 500: string (text/plain)

GET /article/{id}

Get single article

Responses
  • 200: Article (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

POST /article/{id}

Update article

Request

CreateArticle (application/json)

Responses
  • 200: Article (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

DELETE /article/{id}

Deactivate article

Responses
  • 200: Article (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

GET /article/{id}/transaction

Get all article transactions

Responses
  • 200: array of Transaction (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

GET /compensation

Get all compensations

Responses
  • 200: array of Compensation (application/json)
  • 500: string (text/plain)

GET /compensation/{id}

Get compensation

Request a specific compensation by id.

Responses
  • 200: Compensation (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

GET /settings

Settings

Get all settings that can be used for the frontend.

Responses

GET /transaction

Get all transactions

Responses
  • 200: array of Transaction (application/json)
  • 500: string (text/plain)

POST /transaction

Create transaction

Request

CreateTransaction (application/json)

Responses
  • 201: Transaction (application/json)
  • 500: string (text/plain)

GET /transaction/{id}

Get single transaction

Responses
  • 200: Transaction (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

DELETE /transaction/{id}

Undo transaction

Responses
  • 200: Transaction (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

GET /user

Get all users

Responses
  • 200: array of User (application/json)
  • 500: string (text/plain)

POST /user

Create user

Request

CreateUser (application/json)

Responses
  • 201: array of User (application/json)
  • 500: string (text/plain)

GET /user/search/{term}

Search users

Responses
  • 200: User (application/json)
  • 500: string (text/plain)

GET /user/{id}

Get single user

Responses
  • 200: User (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

POST /user/{id}

Update user

Request

CreateUser (application/json)

Responses
  • 200: User (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

DELETE /user/{id}

Delete user

“Deletes” the user. User is set to deleted, but actual data is kept.

Responses
  • 200: User (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

GET /user/{id}/transaction

Get all user transactions

Responses
  • 200: array of Transaction (application/json)
  • 404: string (text/plain)
  • 500: string (text/plain)

Components

Article

Everything about an article in storage and while working with it.

propertytypedescriptiondefault
activebooleanIs the article active.-
barcodesstring[]Optional barcode mainly to be used in barmode in the frontend.-
createdintegerTimestamp of the article creation-
idintegerUnique id, gets allocated by the storage backend.-
inventoryintegerStock of the article-
inventory_overrideInventoryInventory boundary override for this article.-
labelsstring[]Optional labels for sorting in the frontend.-
namestringArticle name, only one article with the same name can be active at the same time.-
pricesPrice[]Versioned price information for the article-
usage_countintegerHow often has the article been bought.-

Boundaries

Describes all configured limits for actions and objects.

propertytypedescriptiondefault
account_lowerintegerSet the lower balance limit for accounts in cents.
No value equals i32::MIN.
-10000
account_upperintegerSet the upper balance limit for accounts in cents.
No value equals i32::MAX.
20000
inventoryInventorySets the type of override for inventory boundaries-
transactionintegerSet the (positive/negative) monetary transaction limit.
None equals i32::MAX/i32::MIN.
10000

Capabilities

Describes all toggleable features for the instance.

propertytypedescriptiondefault
articlesbooleanToggles the article system.
Also disables compensations if disabled.
true
compensationsbooleanAllows to rebalance articles without money transfer.
articles has to be enabled for the feature to work.
true
custom_purchase_pricebooleanToggles the possibility to set a custom price when filling up articles.true
frontendbooleanToggles the builtin frontend. Frontend related information will still be available through
the api.
true
inventorybooleanToggles the inventory system.true
inventory_overridebooleanToggles the ability to optionally set per article inventory boundaries.true
user_transactionsbooleanToggles the possibility for users to directly send money between them.true

Compensation

External representation of a compensation. Compensations are used to allow changing the inventory of an Article without affecting a user.

propertytypedescriptiondefault
amountintegerAmount of articles that are compensated-
articleintegerArticle the compensation applies to-
createdintegerTimestamp of the compensations creation-
idintegerUnique id-
reasonCompensationReasonReason the compensation has to be done-

CompensationReason

Reason the compensation has to be done

  • bar: Bar transaction used to pay article
  • shrinkage: Compensate for missing articles noticed during inventory taking
  • enlargement: An article is bought without a user taking credit
  • buy: An article is bought without a user taking credit (e.g. cash payments)
  • error: Compensation for error in prior compensation

string “bar”|“shrinkage”|“enlargement”|“buy”|“error”

CreateArticle

Representing needed values to crate/update a new Article. When updating, all values have to be filled out with their new values, even when not changing them.

propertytypedescriptiondefault
activeboolean-
barcodesstring[]Optional barcode mainly to be used in barmode in the frontend.-
costintegerCost of the article in cents.-
inventory_overrideInventoryInventory boundary override for this article.-
labelsstring[]Optional labels to tag an article-
namestringArticle name, only one article with the same name can be active at the same time.-
purchase_priceintegerThe amount of money a user receives when filling up the article. If unset, defaults to
cost. Can be overridden by the user if
custom_purchase_price in Capabilities is true.
-

CreateCompensation

Representing values needed to create a new Compensation.

propertytypedescriptiondefault
amountintegerAmount of articles that are compensated-
reasonCompensationReasonReason the compensation has to be done-

CreateTransaction

Representing the possible information for creating a new Transaction.

propertytypedescriptiondefault
amountintegerIf article given functions as article amount, if not as cents.
Negative article amount means filling up the article.
-
articlestringOptional article, if given changes how the amount works.-
commentstringOptional comment to the transaction. Can be shown in frontend.-
purchase_overridePurchaseOverrideUser override for purchase_price of an Article. Only allowed if
custom_purchase_price in Capabilities is true in the Settings.
-
recipientstringSet if users send money between them.-
userstringMain user affected by the transaction.-

CreateUser

Struct representing the needed possible values for a Users creation. All other values are calculated/generated. When updating all values have to be filled out.

propertytypedescriptiondefault
emailstringOptional email of the user.-
namestringUsername-

Currency

Available currencies, used for the frontend.

string “euro”

Frontend

Config usable for a frontend

propertytypedescriptiondefault
auto_open_articlesbooleanShould the article section on a users page be automatically opened.true
cash_infostringInfo shown on cash payment siteregister cash payments
depositinteger[]Values that should be set in the deposit section on a users page.[100, 200, 500, 1000, 2000]
dispenseinteger[]Values that should be set in the dispense section on a users page.[100, 200, 500, 1000, 2000]
random_soundsnumberPercentage of the random sounds being used, from 0 to 1.0.019999999552965164

Inventory

Sets the type of override for inventory boundaries

One of:

string “infinite” or:

propertytypedescriptiondefault
boundInventoryBoundCustom override. If a value isn’t set, it counts as i32::MAX/i32::MIN.-

InventoryBound

Upper and lower bounds for bound in Inventory.

propertytypedescriptiondefault
lowerintegerLower inventory limit, unset equals to i32::MIN.-
upperintegerUpper inventory limit, unset equals to i32::MAX.-

Price

Versioned price information for Articles

propertytypedescriptiondefault
costintegerCost of the article-
createdintegerTimestamp of the creation of this price version-
purchase_priceintegerThe amount of money a user receives when filling up the article. If unset, defaults to
cost. Can be overridden by the user if custom_purchase_price in the Capabilities is true.
-
versionintegerVersion of the Price information-

PurchaseOverride

Struct used for overriding the set purchase price of an article when filling.

propertytypedescriptiondefault
unitintegerUnit of the override, as in amount of the product costing value.-
valueintegerValue of the override-

Settings

Representing the backend config with the necessary info for a frontend or user

propertytypedescriptiondefault
boundariesBoundariesBoundaries for accounts, transactions and the inventory.-
capabilitiesCapabilitiesWhich features are enabled for the instance.-
currencyCurrencyUsed Currency for the instance. Mainly used for frontend.euro
frontendFrontendDefault options for the frontend.
Frontend options are passed one to one to the frontend and are otherwise ignored by the backend.
-
undo_timeoutintegerSet the timeout a transaction can be undone in seconds. If no value is set users are always
allowed to undo. If set to 0, undo is disabled.
600
user_timeoutintegerTime a user will be set as active after their last interaction (transaction/edit).86000

Transaction

Struct representing everything about a single transaction.

propertytypedescriptiondefault
amountintegerIf article given functions as article amount, if not as cents.
Negative article amount means filling up the article.
-
articleintegerOptional article, if given changes how the amount works. Requires price_version to be
set
-
commentstringOptional comment to the transaction. Can be shown in frontend.-
createdintegerTimestamp of the transactions creation-
deletedbooleanHas the transaction been undone.-
idintegerUnique id, gets allocated by the storage backend.-
isdeletablebooleanShows if the transaction can be undone by a user.-
price_versionintegerVersion of the article price, has to be set if article is set.-
purchase_overridePurchaseOverrideUser override for purchase_price of an Article. Only allowed if
custom_purchase_price in Capabilities is true in the Settings.
-
recipientintegerSet if users send money between them.-
userintegerMain user affected by the transaction.-

User

Everything about an user in storage and while working with it.

propertytypedescriptiondefault
activebooleanHas the user been active over a certain time, set in the Settings with user_timeout.-
balanceintegerCurrent balance of the user in cent-
createdintegerTimestamp of the users creation-
deletedbooleanHas the user been deleted? Deletion is only reversible with direct database access.-
emailstringOptional email of the user.-
idintegerUnique id, gets allocated by the storage backend.-
modifiedintegerTimestamp of the last modification to the user (transaction/edit)-
namestringUsername-