DELETE /v1/categories/{name}

Delete a category. If it is in use, replace_with must name a category to move its transactions and rules to.

Auth. Send the token in the X-Ledger-Token header.

Parameters

NameInTypeRequiredDescription
namepathstringrequired
replace_withquerystringoptionalCategory that takes over the transactions and rules of the deleted one

Responses

StatusMeaningBody
204Deleted—
400Request rejectedError
404Request rejectedError
409In use without replace_with, or built in. The body gives the usage counts when in use.object
429Too many requests from this client address. Wait the number of seconds in Retry-After, then try again.Error

Code samples

Set KEY to your own token first.

curl

curl \
  -X DELETE \
  -H X-Ledger-Token:$KEY \
  "https://api.sasek.org/ledger/v1/categories/{name}"

JavaScript

const res = await fetch("https://api.sasek.org/ledger/v1/categories/{name}", {
  method: "DELETE",
  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/{name}",
    method="DELETE",
    headers={
        "X-Ledger-Token": os.environ["KEY"],
    },
)
with urllib.request.urlopen(request) as response:
    print(json.load(response))