GET /v1/categories
The category list, with how many transactions use each one
Auth. Send the token in the X-Ledger-Token header.
Responses
| Status | Meaning | Body |
|---|---|---|
200 | Categories, ordered by name | Category[] |
429 | Too many requests from this client address. Wait the number of seconds in Retry-After, then try again. | Error |
Example response
[
{
"name": "string",
"transactions": 0
}
]
Code samples
Set KEY to your own token first.
curl
curl \
-H X-Ledger-Token:$KEY \
"https://api.sasek.org/ledger/v1/categories"
JavaScript
const res = await fetch("https://api.sasek.org/ledger/v1/categories", {
headers: { "X-Ledger-Token": KEY },
});
const data = await res.json();
Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://api.sasek.org/ledger/v1/categories",
method="GET",
headers={
"X-Ledger-Token": os.environ["KEY"],
},
)
with urllib.request.urlopen(request) as response:
print(json.load(response))