REST APIeasy-svg-pro/v1/repair/one

easy-svg-pro/v1/repair/one

Mends one SVG attachment in place after backing up its original.

REST endpoint · Easy SVG Pro · Status: Internal · Defined in includes/repair/repair.php

Internal: not part of the promised public surface. It may change without notice.

Usage

POST /wp-json/easy-svg-pro/v1/repair/one

Example

curl -X POST "https://example.com/wp-json/easy-svg-pro/v1/repair/one" \
	-H "X-WP-Nonce: $NONCE" -b "$COOKIES" \
	-H "Content-Type: application/json" \
	-d '{"attachment": 314}'

Description

Adds a missing viewBox and strips editor ballast such as metadata and Inkscape or Illustrator namespaces, then runs the result through the sanitizer. Nothing is written until the original is stored; the attachment must be an SVG inside the uploads folder. Rasters and text are reported, never changed.

Permission: manage_options and an active licence with the Repair broken SVGs feature switched on under Icons, Features.

Parameters

body
attachmentinteger
Required

The attachment to repair. Minimum 1.

Return value

returnobject

{state, message} plus, when state is repaired, fixed, bytes_before and bytes_after. Other states: nothing_to_mend, refused_malformed, refused_too_large, refused_sanitiser, backup_failed, write_failed, unreadable. 400 easy_svg_pro_bad_attachment or easy_svg_pro_outside_uploads, 409 easy_svg_pro_no_sanitizer.

Response

{state, message} plus, when state is repaired, fixed, bytes_before and bytes_after. Other states: nothing_to_mend, refused_malformed, refused_too_large, refused_sanitiser, backup_failed, write_failed, unreadable. 400 easy_svg_pro_bad_attachment or easy_svg_pro_outside_uploads, 409 easy_svg_pro_no_sanitizer.

{
  "state": "repaired",
  "fixed": [
    "no_viewbox"
  ],
  "bytes_before": 2048,
  "bytes_after": 1630,
  "message": "..."
}
This rewrites a file in the uploads folder. The original is kept and can be downloaded from the SVG cleaner's originals list.