admin-components

Update, publish or unpublish a component

Partial update. Only the keys of AdminComponentPatch are taken from the body; any other key is ignored. Values are passed to PocketBase without further validation, so anything PocketBase rejects (and invalid JSON) answers 500.

  • brand is a brand name: it is matched or created in component_brands; an empty or non-string value clears the relation.
  • published: true enforces the publication gate: summary (sent, or else stored) must be non-empty, otherwise 400. A sent non-empty slug is used; without a sent or stored slug one is derived from name and brand and made unique with -2 … -50 (500 when none is free); a stored slug is kept when none is sent. published_at is set to now when neither sent nor stored.
  • affiliate_links (when an array) replaces the link set: stored links whose id is missing from the array are deleted, entries with id are updated (url, country), entries without id are created; entries lacking url or country are skipped.

Afterwards the cached component reads and the public pages /components and /components/<slug> are revalidated.

patch/api/admin/components/{id}

Request

  • Base URL: https://voltplan.app
  • URL: https://voltplan.app/api/admin/components/{id}
  • Auth: HTTP bearer

Request body

namestring
typestring

Component type: battery, charger, inverter, transformer, load, power, fuse, shunt, switch, disconnect, bridge or tool; "" when unset.

descriptionstring
imagestring
iconstring
wattnumber nullable
voltage_innumber nullable
voltage_in_typestring

ac, dc, or "" when unset.

voltage_outnumber nullable
voltage_out_typestring

ac, dc, or "" when unset.

estd_price_euronumber nullable
duty_cyclenumber nullable

Share of time a load cycles on. Percentage 0–100.

default_utilization_factornumber nullable

Default share of time a load is used. Percentage 0–100.

usage_hours_per_daynumber nullable
amperagenumber nullable
cutoff_voltagenumber nullable
fuse_typestring
wire_gaugestring
preferred_suggestionboolean
publishedboolean

true runs the publication gate described on the operation.

published_atstring

PocketBase datetime; set to now on first publication when empty.

slugstring

Public URL segment of /components/<slug>; unique among non-empty values.

summarystring

Lead paragraph of the public page.

safety_notesstring[] nullable

Wiring hazards shown in the amber callout of the public page.

works_withstring[]

Ids of curated companion components.

works_with_notesobject nullable

Component id → short pairing note.

brandstring nullable

Brand name, matched or created in component_brands; empty or non-string clears the brand.

Response

Updated record (without expand).

successunknown required

Changes

No recorded changes to this operation across all 1 revision of this API.