611 lines
23 KiB
YAML
611 lines
23 KiB
YAML
# This is an OpenAPI Spec of hledger-web's JSON-over-HTTP API:
|
|
#
|
|
# https://hledger.org/hledger-web.html#json-api
|
|
#
|
|
# Originally generated by openapi-devtools:
|
|
#
|
|
# https://github.com/AndrewWalsh/openapi-devtools
|
|
# https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/haskell-yesod.md
|
|
#
|
|
# and then modified by hand.
|
|
|
|
|
|
openapi: 3.1.0
|
|
|
|
info:
|
|
title: hledger-web API
|
|
description: >
|
|
Provides interaction with hledger, the plaintext accounting tool powered by
|
|
Haskell. Lookup account details, balances, commodity prices, and
|
|
transactions.
|
|
version: 1.0.0
|
|
|
|
servers:
|
|
- url: http://127.0.0.1:5000
|
|
description: Locally hosted server for hledger-web API
|
|
|
|
|
|
paths:
|
|
|
|
/version:
|
|
get:
|
|
summary: The hledger version
|
|
description: Returns the hledger version that powers this API as a SemVer string.
|
|
operationId: hledger_version
|
|
responses:
|
|
"200":
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema: {}
|
|
security:
|
|
- apikey_cookie__session: []
|
|
- apikey_header_cookie: []
|
|
|
|
/accountnames:
|
|
get:
|
|
summary: Account names
|
|
description: Returns all of the account names in a JSON array
|
|
operationId: hledger_account_names
|
|
responses:
|
|
"200":
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items: {}
|
|
security:
|
|
- apikey_cookie__session: []
|
|
- apikey_header_cookie: []
|
|
|
|
/transactions:
|
|
get:
|
|
summary: Transaction query
|
|
description: >
|
|
Queries the journal for transactions (txs). Returns a list of JSON
|
|
objects describing the tx postings.
|
|
responses:
|
|
"200":
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items:
|
|
required:
|
|
- tcode
|
|
- tcomment
|
|
- tdate
|
|
- tdate2
|
|
- tdescription
|
|
- tindex
|
|
- tpostings
|
|
- tprecedingcomment
|
|
- tsourcepos
|
|
- tstatus
|
|
- ttags
|
|
properties:
|
|
tcode: {}
|
|
tcomment: {}
|
|
tdate: {}
|
|
tdate2: {}
|
|
tdescription: {}
|
|
tindex: {}
|
|
tpostings:
|
|
items:
|
|
required:
|
|
- paccount
|
|
- pamount
|
|
- pbalanceassertion
|
|
- pcomment
|
|
- pdate
|
|
- pdate2
|
|
- poriginal
|
|
- pstatus
|
|
- ptags
|
|
- ptransaction_
|
|
- ptype
|
|
properties:
|
|
paccount: {}
|
|
pamount:
|
|
items:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost:
|
|
anyOf:
|
|
- {}
|
|
- required:
|
|
- contents
|
|
- tag
|
|
properties:
|
|
contents:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
tag: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
pbalanceassertion: {}
|
|
pcomment: {}
|
|
pdate: {}
|
|
pdate2: {}
|
|
poriginal: {}
|
|
pstatus: {}
|
|
ptags: {}
|
|
ptransaction_: {}
|
|
ptype: {}
|
|
tprecedingcomment: {}
|
|
tsourcepos:
|
|
items:
|
|
required:
|
|
- sourceColumn
|
|
- sourceLine
|
|
- sourceName
|
|
properties:
|
|
sourceColumn: {}
|
|
sourceLine: {}
|
|
sourceName: {}
|
|
tstatus: {}
|
|
ttags: {}
|
|
security:
|
|
- apikey_cookie__session: []
|
|
- apikey_header_cookie: []
|
|
|
|
/prices:
|
|
get:
|
|
summary: Commodity prices
|
|
description: >
|
|
Queries the journal for commodity prices. Returns a list of JSON objects
|
|
with commodity price information.
|
|
operationId: hledger_commodity_prices
|
|
responses:
|
|
"200":
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items:
|
|
required:
|
|
- mpdate
|
|
- mpfrom
|
|
- mprate
|
|
- mpto
|
|
properties:
|
|
mpdate: {}
|
|
mpfrom: {}
|
|
mprate:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
mpto: {}
|
|
security:
|
|
- apikey_cookie__session: []
|
|
- apikey_header_cookie: []
|
|
|
|
/commodities:
|
|
get:
|
|
operationId: hledger_commodity_symbols
|
|
summary: Commodity symbols
|
|
description: >
|
|
List all tracked commodities in the ledger. Returns a JSON list of
|
|
strings of commodity symbols
|
|
responses:
|
|
"200":
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items: {}
|
|
security:
|
|
- apikey_cookie__session: []
|
|
- apikey_header_cookie: []
|
|
|
|
/accounts:
|
|
get:
|
|
operationId: hledger_accounts
|
|
summary: Account information
|
|
description: >
|
|
Queries the journal for account information. Returns a JSON list of
|
|
account objects
|
|
responses:
|
|
"200":
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items:
|
|
required:
|
|
- aboring
|
|
- adeclarationinfo
|
|
- aebalance
|
|
- aibalance
|
|
- aname
|
|
- anumpostings
|
|
- aparent_
|
|
- asubs
|
|
- asubs_
|
|
properties:
|
|
aname: {}
|
|
adeclarationinfo: {}
|
|
aebalance:
|
|
items:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost:
|
|
anyOf:
|
|
- {}
|
|
- required:
|
|
- contents
|
|
- tag
|
|
properties:
|
|
contents:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
tag: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
aibalance:
|
|
items:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost:
|
|
anyOf:
|
|
- {}
|
|
- required:
|
|
- contents
|
|
- tag
|
|
properties:
|
|
contents:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
tag: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
anumpostings: {}
|
|
aboring: {}
|
|
aparent_: {}
|
|
asubs_:
|
|
items: {}
|
|
asubs: {}
|
|
security:
|
|
- apikey_cookie__session: []
|
|
- apikey_header_cookie: []
|
|
|
|
/accounttransactions/{name}:
|
|
get:
|
|
operationId: hledger_account_txs
|
|
summary: Account transactions
|
|
description: >
|
|
List transactions in the requested account. Returns a JSON list of
|
|
transaction objects (txs).
|
|
parameters:
|
|
- name: name
|
|
in: path
|
|
required: true
|
|
description: The account name to lookup
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Successful Response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items:
|
|
items:
|
|
anyOf:
|
|
- {}
|
|
- items:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
- required:
|
|
- tcode
|
|
- tcomment
|
|
- tdate
|
|
- tdate2
|
|
- tdescription
|
|
- tindex
|
|
- tpostings
|
|
- tprecedingcomment
|
|
- tsourcepos
|
|
- tstatus
|
|
- ttags
|
|
properties:
|
|
tcode: {}
|
|
tcomment: {}
|
|
tdate: {}
|
|
tdate2: {}
|
|
tdescription: {}
|
|
tindex: {}
|
|
tpostings:
|
|
items:
|
|
required:
|
|
- paccount
|
|
- pamount
|
|
- pbalanceassertion
|
|
- pcomment
|
|
- pdate
|
|
- pdate2
|
|
- poriginal
|
|
- pstatus
|
|
- ptags
|
|
- ptransaction_
|
|
- ptype
|
|
properties:
|
|
paccount: {}
|
|
pamount:
|
|
items:
|
|
required:
|
|
- acommodity
|
|
- acost
|
|
- aquantity
|
|
- astyle
|
|
properties:
|
|
acommodity: {}
|
|
acost: {}
|
|
aquantity:
|
|
required:
|
|
- decimalMantissa
|
|
- decimalPlaces
|
|
- floatingPoint
|
|
properties:
|
|
decimalMantissa: {}
|
|
decimalPlaces: {}
|
|
floatingPoint: {}
|
|
astyle:
|
|
required:
|
|
- ascommodityside
|
|
- ascommodityspaced
|
|
- asdecimalmark
|
|
- asdigitgroups
|
|
- asprecision
|
|
- asrounding
|
|
properties:
|
|
ascommodityside: {}
|
|
ascommodityspaced: {}
|
|
asdecimalmark: {}
|
|
asdigitgroups: {}
|
|
asprecision: {}
|
|
asrounding: {}
|
|
pbalanceassertion: {}
|
|
pcomment: {}
|
|
pdate: {}
|
|
pdate2: {}
|
|
poriginal: {}
|
|
pstatus: {}
|
|
ptags: {}
|
|
ptransaction_: {}
|
|
ptype: {}
|
|
tprecedingcomment: {}
|
|
tsourcepos:
|
|
items:
|
|
required:
|
|
- sourceColumn
|
|
- sourceLine
|
|
- sourceName
|
|
properties:
|
|
sourceColumn: {}
|
|
sourceLine: {}
|
|
sourceName: {}
|
|
tstatus: {}
|
|
ttags: {}
|
|
security:
|
|
- apikey_cookie__session: []
|
|
- apikey_header_cookie: []
|
|
|
|
components:
|
|
schemas: {}
|
|
securitySchemes:
|
|
apikey_cookie__session:
|
|
type: apiKey
|
|
name: _session
|
|
in: cookie
|
|
apikey_header_cookie:
|
|
type: apiKey
|
|
name: COOKIE
|
|
in: header
|