REST APIeasy-svg-pro/v1/styles/templates

easy-svg-pro/v1/styles/templates

Replaces the whole list of style templates.

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

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

Usage

POST /wp-json/easy-svg-pro/v1/styles/templates

Example

curl -X POST "https://example.com/wp-json/easy-svg-pro/v1/styles/templates" \
	-H "X-WP-Nonce: $NONCE" -b "$COOKIES" \
	-H "Content-Type: application/json" \
	-d '{"templates": {"brand": {"label": "Brand", "size": 24, "colour": "primary", "spacing": 4}}}'

Description

The body's templates map replaces what is stored, it is not merged. Names must be lowercase letters, digits, hyphen or underscore; size is clamped to 8 to 512 px, spacing must be one of the fixed steps and colour is a palette slug, a hex value or empty. At most 50 templates are kept, and assignments naming a deleted template are dropped.

Permission: manage_options and an active licence with the Styles & theme colors feature switched on under Icons, Features.

Parameters

body
templatesobject
Required

Every template the site should have after this write, keyed by template name.

Return value

returnobject

The full style settings after the write, same shape as GET /styles.

Response

The full style settings after the write, same shape as GET /styles.

{
  "templates": {
    "brand": {
      "label": "Brand",
      "size": 24,
      "colour": "primary",
      "spacing": 4
    }
  },
  "icons": {
    "acme/arrow": {
      "template": "brand",
      "colours": {}
    }
  },
  "palette": {
    "primary": {
      "label": "Primary",
      "color": "#0a2540"
    }
  },
  "spacing": [
    0,
    2,
    4,
    8,
    12,
    16,
    24,
    32
  ],
  "registrable": true
}
Sending a partial list deletes every template you left out.