Portfolio

Edit, add or remove records: a unit, building, lease, contact or any other

The write path for everything the owner edits, and the way to update, change or set any field of a record, such as a unit’s purchase price (acquisition), a lease’s rent or a contact’s address. To change some fields of a record that exists, send a patch naming the collection, the id and only those fields; read the record first if you need what it holds. An upsert writes a whole record, which is how a new one is added. The whole list is applied in one D1 batch, so it either all lands or none of it does, and it is applied in the order it was given. The changes go into the signed-in owner’s rows and there is no way to address anyone else’s. Every record carries a server-owned rev: an upsert or a remove sends the revision it was based on, the account checks that the row still stands there, and a batch with a stale change in it is refused whole with the current rows in the 409 body. A record written for the first time carries no rev and comes back at 1.

post/api/v1/portfolio/changes

Request

  • Base URL: http://localhost:5180
  • URL: http://localhost:5180/api/v1/portfolio/changes
  • Auth: API key in cookie better-auth.session_token

Request body

schemaVersioninteger

The schema the client was built against, as GET /portfolio reports it (currently 10). Any other value, or none, is refused: a page from an older build must not keep writing older rows. A batch of patches alone may leave it out, because a patch writes onto the record in the shape the account holds it.

Response

Every change was written. revs is what each upserted record is at now.

okunknown required

Changes

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