Contents
On this page

Create Share Set - Plugixa Easy Social Share Buttons

POST /plugixa-social-share/v1/sets

Create a share set: a row of buttons with its own networks and look, placed automatically, by hand, or both.

An account with the plugixa_social_share_edit capability. Administrators hold it; no other role does until you grant it.

Request

POST https://your-site.example/wp-json/plugixa-social-share/v1/sets

Request body

Content type: application/json

Field Type Required Description
name string No At most 80 characters; HTML is stripped. Empty means unnamed: the set is then called “Share set N”.
instance object No The networks and the look. Defaults to the six networks and look in defaults from List Share Sets.
placements object No Where the set appears on its own. Omitted, it appears only where you place it by hand: a shortcode, a block or a template tag.

The instance object

Field Type Required Description
networks string[] Yes Network slugs, in the order the buttons are drawn. A repeated slug is dropped, keeping the first. At least one must be a network the plugin knows: the catalogue lists them.
template string No The style. Default default. A style that does not exist on the site becomes default.
layout string No full (icon and label, the default), icon or stacked.
align string No start (the default), center, end or stretch.
counts boolean No Show each network’s count. Default false.
total boolean No Show the combined total. Default false.
label string No A heading above the row. HTML is stripped.
vertical boolean No Stack the buttons in a column. Default false.
size string No xsmall, small, medium (the default), large, xlarge or xxlarge.
size_mobile string No inherit (the default: same as size) or one of the sizes.
count_pos string No Where each count sits: after (the default), before, right, left, above, below or bubble.
total_pos string No Where the total sits: after (the default), before, left or right.
more boolean No End the row with a “+” button that opens the networks the row does not show. Default false.
color string No One hex colour for every button instead of each network’s own, saved as #rrggbb. Empty for brand colours.
ink string No The label colour on color, as #rrggbb. Empty to have it chosen for contrast. Dropped when color is empty.

Any other value outside the listed choices falls back to that field’s default instead of failing the request. A network slug the plugin does not know is kept as sent, but draws no button.

The placements object

An object keyed by post type slug (post, page, …), or by _home for the blog home and _archive for archives. List Share Sets returns the keys this site accepts in post_types. Each value is:

Field Type Required Description
content string No none (the default), content_top, content_bottom or content_both.
extra string[] No Other automatic spots: float_left, float_right, top_bar, bottom_bar, mobile_bar, and product_summary on product only. Pro adds popup and flyin. Anything else is dropped.

A key that is not offered on this site right now is ignored, and an entry that places nothing is dropped. A spot belongs to one set at a time: when this set claims a spot another set holds on the same key, it is taken from that set and reported in moved.

{
  "name": "Footer row",
  "instance": {
    "networks": [
      "facebook",
      "x",
      "copy"
    ],
    "template": "pill",
    "layout": "icon"
  },
  "placements": {
    "post": {
      "content": "content_bottom",
      "extra": []
    }
  }
}

Responses

201 Created. data.item is the new set.

{
  "success": true,
  "data": {
    "item": {
      "id": 2,
      "name": "Footer row",
      "instance": {
        "networks": [
          "facebook",
          "x",
          "copy"
        ],
        "template": "pill",
        "layout": "icon",
        "align": "start",
        "counts": false,
        "total": false,
        "label": "",
        "vertical": false,
        "size": "medium",
        "size_mobile": "inherit",
        "count_pos": "after",
        "total_pos": "after",
        "more": false,
        "color": "",
        "ink": ""
      },
      "placements": {
        "post": {
          "content": "content_bottom",
          "extra": []
        }
      },
      "created": 1794475800,
      "modified": 1794475800,
      "label": "Footer row"
    },
    "moved": [
      {
        "set_id": 1,
        "post_type": "post",
        "slot": "content_bottom",
        "set_label": "Share set 1",
        "post_type_label": "Posts",
        "slot_label": "Below the content"
      }
    ],
    "items": [
      {
        "id": 1,
        "name": "",
        "instance": {
          "networks": [
            "facebook",
            "x",
            "linkedin",
            "whatsapp",
            "email",
            "copy"
          ],
          "template": "default",
          "layout": "full",
          "align": "start",
          "counts": false,
          "total": false,
          "label": "",
          "vertical": false,
          "size": "medium",
          "size_mobile": "inherit",
          "count_pos": "after",
          "total_pos": "after",
          "more": false,
          "color": "",
          "ink": ""
        },
        "placements": {
          "page": {
            "content": "content_bottom",
            "extra": []
          }
        },
        "created": 1793000000,
        "modified": 1794475800,
        "label": "Share set 1"
      },
      {
        "id": 2,
        "name": "Footer row",
        "instance": {
          "networks": [
            "facebook",
            "x",
            "copy"
          ],
          "template": "pill",
          "layout": "icon",
          "align": "start",
          "counts": false,
          "total": false,
          "label": "",
          "vertical": false,
          "size": "medium",
          "size_mobile": "inherit",
          "count_pos": "after",
          "total_pos": "after",
          "more": false,
          "color": "",
          "ink": ""
        },
        "placements": {
          "post": {
            "content": "content_bottom",
            "extra": []
          }
        },
        "created": 1794475800,
        "modified": 1794475800,
        "label": "Footer row"
      }
    ],
    "primary": 1
  }
}
Field Type Meaning
data.item.id integer The set’s number. Never reused, even after the set is deleted
data.item.name string The name as saved, empty when the set is unnamed
data.item.label string The name, or “Share set N” when the set is unnamed
data.item.instance object The look: see The instance object
data.item.placements object Where the set appears on its own, keyed by post type. {} when it is placed by hand only
data.item.created integer Unix time the set was created
data.item.modified integer Unix time of the last save
data.moved array The spots this save took from other sets, empty when none
data.moved[].set_id integer The set the spot was taken from
data.moved[].post_type string The placement key, such as post
data.moved[].slot string The spot, such as content_bottom
data.moved[].set_label, post_type_label, slot_label string The same three, in words
data.items array Every share set as it now stands, lowest number first
data.primary integer The default set: the lowest number that exists, 0 when there are none

Errors

Status Code When
400 plugixa_social_share_set_invalid The instance names no network the plugin knows. data.field is instance.networks.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-social-share/v1/sets" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Footer row","instance":{"networks":["facebook","x","copy"],"template":"pill","layout":"icon"},"placements":{"post":{"content":"content_bottom","extra":[]}}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-social-share/v1/sets');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'       => 'Footer row',
        'instance'   => [
            'networks' => ['facebook', 'x', 'copy'],
            'template' => 'pill',
            'layout'   => 'icon',
        ],
        'placements' => [
            'post' => [
                'content' => 'content_bottom',
                'extra'   => [],
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-social-share/v1/sets', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Footer row', instance: { networks: ['facebook', 'x', 'copy'], template: 'pill', layout: 'icon' }, placements: { post: { content: 'content_bottom', extra: [] } } }),
});
const { data } = await response.json();

Quick Links

Share