Source code

Edit source files with string replacement

Atomically applies ordered exact-string edits to up to 50 files and 200 edits in total as one head version. Each oldStr must match once unless replaceAll is true, and any failing edit aborts the whole call. Set dryRun to validate and count replacements without committing. Takes the edit lease when no leaseToken is sent.

post/websiteSourceCode/files/str-replace

Request

  • Base URL: https://api.cactal.ai/v1
  • URL: https://api.cactal.ai/v1/websiteSourceCode/files/str-replace
  • Auth: HTTP bearer

Request body

websiteIdstring required
dryRunboolean

Validate every edit and report the replacement counts without committing.

leaseTokenstring

Omit to have Cactal take the edit lease for you; pass a token from websiteSourceCode.lease.acquire to take over from another editor.

Response

The new head version plus per-file replacement counts.

versioninteger required

Head version after the edit: the previous head plus one, or the unchanged head when changed is false.

changedboolean required

false when the edit was a no-op and no new version was created.

Changes

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