Apply exact-string find/replace edits to the persisted source

Applies an edits[] array to desired module/ui/styles. ESM saves require Idempotency-Key, return 202, and preserve active output until publication. An exact request-key replay returns the original operation before stale revision or edit matching checks. Each edit names a bucket, an exact old_string to match, and a new_string replacement. Requires If-Match: "<N>" carrying revision N from a fresh source response or ETag. A stale value returns 412 and surfaces the current ETag. Same auth as PUT.

patch/app/{id}/source

Request

  • Base URL: https://charm.ing
  • URL: https://charm.ing/app/{id}/source
  • Auth: one of:
    • HTTP bearer
    • HTTP bearer

Headers

Idempotency-Keystring

Required for ESM saves. Reuse the same key, body, target and If-Match after response loss; a changed request with that key returns idempotency_conflict. Use a fresh key for each intentional save.

If-Matchstring required

Validator "<N>" returned by a fresh GET /source, where N is its revision. The weak form W/"<N>" is accepted too, so a client can pass back the ETag verbatim even when a CDN rewrote it in transit.

Request body

migrate_contractboolean

Explicitly migrate when the edited source selects a new contract. ESM requires the exact schema, a request key and If-Match.

Response

Edits applied; committed server revision returned.

okboolean required
idstring required
revisioninteger required

Server-owned app source revision. New apps start at 1, each successful source write advances it once, and historical null counters project as 0. If-Match: "<N>" and expected_revision carry this revision through its canonical concurrency grammar.

warningsstring[]

Non-blocking publish feedback (#1126), present only when static validation found UI/backend contract mismatches. The write succeeded.

Example response

{
  "revision": 4
}

Changes

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