REST APIeasy-svg-pro/v1/media/markup

easy-svg-pro/v1/media/markup

Turns up to 25 media library SVGs into sanitized, hardened markup for the set editor, without storing anything.

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

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

Usage

POST /wp-json/easy-svg-pro/v1/media/markup

Example

curl -u admin:app-password -H 'Content-Type: application/json' -d '{"ids":[101,102]}' https://example.com/wp-json/easy-svg-pro/v1/media/markup

Description

Only attachment ids travel, so it also works when an offload plugin serves media from another origin where a browser fetch would fail on CORS. Each file is read, run through the site's sanitizer and the free plugin's hardener. A row's state says ok, not_svg, no_file or not_found. Saving still happens through a set write, which sanitizes again. Permission: Requires manage_options, an active licence and the editor feature (Icon set editor) switched on.

Permission: Requires manage_options, an active licence and the editor feature (Icon set editor) switched on.

Parameters

body
idsarray<integer>
Required

Attachment ids of SVGs in the media library, 1 to 25.

Return value

returnWP_REST_Response|WP_Error

rows: per attachment id, label, markup and state (ok, not_svg, no_file or not_found).

Response

rows: per attachment id, label, markup and state (ok, not_svg, no_file or not_found).

{
  "rows": [
    {
      "id": 101,
      "label": "logo",
      "markup": "<svg ...></svg>",
      "state": "ok"
    }
  ]
}