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

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

Adds up to 25 icons to a set and leaves the rest of it alone.

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/sets/{id}/icons/add

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/icons/add

Description

The merge runs on the server against what is stored, so a caller holding only part of the set cannot erase the rest. An icon whose slug is already in the set is reported as exists and not overwritten, unless replace is true, which reports replaced. Every icon is sanitized and hardened. Errors: 404 easy_svg_pro_no_set, 409 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
Required

Icons to add, as a slug keyed map or a list of {slug, label, markup}; at most 25.

body
replaceboolean

Overwrite an icon whose slug is already in the set. Default false.

Return value

returnWP_REST_Response|WP_Error

The set as it now stands: id, slug, label, icons and report, a list of {slug, state} with state added, replaced or exists.

Response

The set as it now stands: id, slug, label, icons and report, a list of {slug, state} with state added, replaced or exists.

{
  "id": 42,
  "slug": "acme",
  "label": "ACME",
  "icons": [
    {
      "slug": "arrow",
      "label": "Arrow",
      "markup": "<svg ...></svg>"
    }
  ],
  "report": [
    {
      "slug": "arrow",
      "state": "added"
    }
  ]
}