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

easy-svg-pro/v1/library/markup

Returns the stored SVG markup for up to 200 icons, named as collection/slug.

REST endpoint, Easy SVG Pro, Status: Public, defined in includes/core/library-grid.php

Usage

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

Example

curl -u admin:app-password -H 'Content-Type: application/json' -d '{"refs":["acme/arrow","acme/phone"]}' https://example.com/wp-json/easy-svg-pro/v1/library/markup

Description

The Icons panel asks this route for the drawings of the icons it is about to show, after library/index gave it the names. Each ref is collection/slug. A ref is read once even when it is sent twice. A ref without a slash, an unknown collection or an unknown icon is left out of the answer without an error. More than 200 refs are refused by the schema with 400. The markup is the stored, already sanitized drawing; nothing is written.

Permission: manage_options and an active license. No feature switch is needed. WordPress checks the required arguments before the permission callback, so a request without them answers 400, even from a guest.

Parameters

body
refsarray<string>
Required

The icons to read, as collection/slug. At most 200.

Return value

returnWP_REST_Response|WP_Error

markup, an object from ref to SVG markup, holding only the refs that were found.

Response

{
  "markup": {
    "acme/arrow": "<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">...</svg>"
  }
}