easy-svg/v1/library/replace
Gives one icon a new drawing, keeping its name and slug.
REST endpoint · Easy SVG · Status: Internal · Defined in includes/panel.php
Usage
POST /wp-json/easy-svg/v1/library/replace
Example
curl -X POST https://example.com/wp-json/easy-svg/v1/library/replace \
-H 'Content-Type: application/json' \
-H 'X-WP-Nonce: <nonce>' \
-d '{"id":42,"markup":"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 2h20v20H2z"/></svg>"}'
Description
Uses easy_svg_update_icon_markup(), so the markup meets the same sanitizer and bounds as an upload. Errors: 404 easy_svg_no_icon, and 422 easy_svg_replace_refused for every other refusal, whether the markup was empty, refused or the write failed.
Permission: manage_options (easy_svg_panel_rest_permission)
Parameters
The icon post id, minimum 1.
The new SVG markup.
Response
items (id, slug, label, content), total and truncated. The list is capped at 500 icons.
{
"items": [
{
"id": 42,
"slug": "heart",
"label": "Heart",
"content": "<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 21l-8-8a5 5 0 0 1 8-6 5 5 0 0 1 8 6z"/></svg>"
}
],
"total": 1,
"truncated": false
}