REST APIeasy-svg-pro/v1/sets/{id}

easy-svg-pro/v1/sets/{id}

Reads one icon set, or replaces all of its icons in one write.

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

GET|POST /wp-json/easy-svg-pro/v1/sets/{id}

Example

curl -u admin:app-password -H 'Content-Type: application/json' -d '{"icons":[{"slug":"arrow","label":"Arrow","markup":"<svg viewBox="0 0 24 24"><path d="M2 12h20"/></svg>"}]}' https://example.com/wp-json/easy-svg-pro/v1/sets/42

Description

GET answers the set with its registered collection slug, which can differ from the post slug by a -x suffix on older sites. POST replaces the whole set: every icon is sanitized and hardened, and an icon left out of the body is removed. Send icons as a map keyed by slug or as a list of {slug, label, markup}. A non-blank label also renames the set. Errors: 404 easy_svg_pro_no_set, 409 easy_svg_pro_no_sanitizer or easy_svg_pro_no_hardener when the free plugin is missing or too old. 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

path
idinteger
Required

The icon set post id.

body
iconsobject|array

POST only. Every icon the set should hold after this write. An icon left out is removed.

body
labelstring

POST only. The new set name; left alone when absent or blank.

Return value

returnWP_REST_Response|WP_Error

GET: id, slug (the registered collection slug), label and icons as a list of {slug, label, markup} sorted by slug. POST: id, icons and saved, the number of icons stored.

Response

GET: id, slug (the registered collection slug), label and icons as a list of {slug, label, markup} sorted by slug. POST: id, icons and saved, the number of icons stored.

{
  "id": 42,
  "slug": "acme",
  "label": "ACME",
  "icons": [
    {
      "slug": "arrow",
      "label": "Arrow",
      "markup": "<svg ...></svg>"
    }
  ]
}
POST replaces the set. Use /sets/{id}/icons/add or /icons/remove when you only hold part of it, or you delete the rest.