imp: web: further document the api endpoints

This commit is contained in:
Ben Sima 2025-05-23 16:15:12 -04:00 committed by Simon Michael
parent 4e9aa5825d
commit 8b027a48e8

View File

@ -1,33 +1,55 @@
# 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 openapi: 3.1.0
info: info:
title: OpenAPI Specification title: hledger-web API
description: "Basic description of [hledger-web's JSON-over-HTTP API](https://hledger.org/hledger-web.html#json-api).\ description: >
\ A specification generated by [openapi-devtools](https://github.com/AndrewWalsh/openapi-devtools).\ Provides interaction with hledger, the plaintext accounting tool powered by
\ Contains 7 endpoints." Haskell. Lookup account details, balances, commodity prices, and
transactions.
version: 1.0.0 version: 1.0.0
servers: servers:
- url: / - url: http://127.0.0.1:5000
description: Locally hosted server for hledger-web API
paths: paths:
/version: /version:
get: get:
summary: /version summary: The hledger version
description: "**Host**: http://127.0.0.1:5000" description: Returns the hledger version that powers this API as a SemVer string.
operationId: hledger_version
responses: responses:
"200": "200":
description: "" description: Successful Response
content: content:
application/json: application/json:
schema: {} schema: {}
security: security:
- apikey_cookie__session: [] - apikey_cookie__session: []
- apikey_header_cookie: [] - apikey_header_cookie: []
/accountnames: /accountnames:
get: get:
summary: /accountnames summary: Account names
description: "**Host**: http://127.0.0.1:5000" description: Returns all of the account names in a JSON array
operationId: hledger_account_names
responses: responses:
"200": "200":
description: "" description: Successful Response
content: content:
application/json: application/json:
schema: schema:
@ -35,13 +57,16 @@ paths:
security: security:
- apikey_cookie__session: [] - apikey_cookie__session: []
- apikey_header_cookie: [] - apikey_header_cookie: []
/transactions: /transactions:
get: get:
summary: /transactions summary: Transaction query
description: "**Host**: http://127.0.0.1:5000" description: >
Queries the journal for transactions (txs). Returns a list of JSON
objects describing the tx postings.
responses: responses:
"200": "200":
description: "" description: Successful Response
content: content:
application/json: application/json:
schema: schema:
@ -180,13 +205,17 @@ paths:
security: security:
- apikey_cookie__session: [] - apikey_cookie__session: []
- apikey_header_cookie: [] - apikey_header_cookie: []
/prices: /prices:
get: get:
summary: /prices summary: Commodity prices
description: "**Host**: http://127.0.0.1:5000" description: >
Queries the journal for commodity prices. Returns a list of JSON objects
with commodity price information.
operationId: hledger_commodity_prices
responses: responses:
"200": "200":
description: "" description: Successful Response
content: content:
application/json: application/json:
schema: schema:
@ -212,13 +241,17 @@ paths:
security: security:
- apikey_cookie__session: [] - apikey_cookie__session: []
- apikey_header_cookie: [] - apikey_header_cookie: []
/commodities: /commodities:
get: get:
summary: /commodities operationId: hledger_commodity_symbols
description: "**Host**: http://127.0.0.1:5000" summary: Commodity symbols
description: >
List all tracked commodities in the ledger. Returns a JSON list of
strings of commodity symbols
responses: responses:
"200": "200":
description: "" description: Successful Response
content: content:
application/json: application/json:
schema: schema:
@ -226,13 +259,17 @@ paths:
security: security:
- apikey_cookie__session: [] - apikey_cookie__session: []
- apikey_header_cookie: [] - apikey_header_cookie: []
/accounts: /accounts:
get: get:
summary: /accounts operationId: hledger_accounts
description: "**Host**: http://127.0.0.1:5000" summary: Account information
description: >
Queries the journal for account information. Returns a JSON list of
account objects
responses: responses:
"200": "200":
description: "" description: Successful Response
content: content:
application/json: application/json:
schema: schema:
@ -407,13 +444,24 @@ paths:
security: security:
- apikey_cookie__session: [] - apikey_cookie__session: []
- apikey_header_cookie: [] - apikey_header_cookie: []
/accounttransactions/1:
/accounttransactions/{name}:
get: get:
summary: /accounttransactions/1 operationId: hledger_account_txs
description: "**Host**: http://127.0.0.1:5000" 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: responses:
"200": "200":
description: "" description: Successful Response
content: content:
application/json: application/json:
schema: schema:
@ -548,6 +596,7 @@ paths:
security: security:
- apikey_cookie__session: [] - apikey_cookie__session: []
- apikey_header_cookie: [] - apikey_header_cookie: []
components: components:
schemas: {} schemas: {}
securitySchemes: securitySchemes: