Contents
On this page

Update Share Set - Plugixa Easy Social Share Buttons

PUT /plugixa-social-share/v1/sets/{id}

Change a share set’s name, look or placements. PATCH does exactly the same.

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

Note. Each of the three fields is replaced whole, or kept when you leave it out. Inside instance nothing is merged: an instance that sends only networks puts every other look field back to its default (template to default, layout to full, counts off). To change one setting, read the set with Get Share Set, change it, and send the whole instance back. The same holds for placements: {} removes the set from every automatic spot.

Request

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

Path parameters

Name Type Description
id integer The share set’s number, the one typed in [plugixa_share id="2"]

Request body

Content type: application/json

Field Type Required Description
name string No At most 80 characters; HTML is stripped. Empty makes the set unnamed. Omitted keeps the stored name.
instance object No The whole look, as in Create Share Set. Omitted keeps the stored look.
placements object No The whole set of automatic spots, as in Create Share Set. Omitted keeps the stored ones.

Spots the set holds on a post type that is not offered right now, for example on products while the shop plugin is switched off, are kept. A spot this save claims is taken from whichever set held it and listed in moved.

{
  "instance": {
    "networks": [
      "facebook",
      "x",
      "bluesky",
      "copy"
    ],
    "template": "pill",
    "layout": "icon",
    "align": "start",
    "counts": true,
    "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": [
        "mobile_bar"
      ]
    }
  }
}

Responses

200 OK. data.item is the updated set.

{
  "success": true,
  "data": {
    "item": {
      "id": 2,
      "name": "Footer row",
      "instance": {
        "networks": [
          "facebook",
          "x",
          "bluesky",
          "copy"
        ],
        "template": "pill",
        "layout": "icon",
        "align": "start",
        "counts": true,
        "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": [
            "mobile_bar"
          ]
        }
      },
      "created": 1794475800,
      "modified": 1794478500,
      "label": "Footer row"
    },
    "moved": [],
    "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",
            "bluesky",
            "copy"
          ],
          "template": "pill",
          "layout": "icon",
          "align": "start",
          "counts": true,
          "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": [
              "mobile_bar"
            ]
          }
        },
        "created": 1794475800,
        "modified": 1794478500,
        "label": "Footer row"
      }
    ],
    "primary": 1
  }
}
Field Type Meaning
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.modified integer Unix time of this save
data.moved array The spots taken from other sets, as in Create Share Set
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
404 plugixa_social_share_not_found No share set with that number. It may have been deleted.
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 PUT "https://your-site.example/wp-json/plugixa-social-share/v1/sets/2" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"instance":{"networks":["facebook","x","bluesky","copy"],"template":"pill","layout":"icon","align":"start","counts":true,"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":["mobile_bar"]}}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-social-share/v1/sets/2');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'instance'   => [
            'networks'    => ['facebook', 'x', 'bluesky', 'copy'],
            'template'    => 'pill',
            'layout'      => 'icon',
            'align'       => 'start',
            'counts'      => true,
            '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'   => ['mobile_bar'],
            ],
        ],
    ]),
]);
$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/2', {
  method: 'PUT',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ instance: { networks: ['facebook', 'x', 'bluesky', 'copy'], template: 'pill', layout: 'icon', align: 'start', counts: true, 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: ['mobile_bar'] } } }),
});
const { data } = await response.json();

Quick Links

Share