Contents
On this page

Save Follow Buttons - Plugixa Easy Social Share Buttons

POST /plugixa-social-share/v1/follow

Replace the site’s follow profiles and the look of the follow row.

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

Note. Both fields are replaced, not merged. A profile left out of profiles is removed, and leaving look out resets the look to its defaults. Read the current state with Get Follow Buttons and send everything back.

Request

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

Request body

Content type: application/json

Field Type Required Description
profiles array Yes The profiles in display order, each { "service": "instagram", "value": "@yourname" }. value is a full address, or a name or handle where the service takes one.
look object No template, layout, align, label, vertical, size, size_mobile, color and ink, with the values a share set instance takes. Defaults: layout icon, the rest as for a share set.

A save is all or nothing: one value that is not a profile on its service fails the whole save, and nothing is written. A service the plugin does not offer, a second entry for the same service, and an entry with an empty value are skipped without an error.

{
  "profiles": [
    {
      "service": "instagram",
      "value": "@yourname"
    },
    {
      "service": "x",
      "value": "https://x.com/yourname"
    }
  ],
  "look": {
    "template": "pill",
    "layout": "icon",
    "align": "center"
  }
}

Responses

200 OK. data is the saved state.

The same shape as Get Follow Buttons, services shortened here.

{
  "success": true,
  "data": {
    "profiles": [
      {
        "service": "instagram",
        "url": "https://www.instagram.com/yourname/"
      },
      {
        "service": "x",
        "url": "https://x.com/yourname"
      }
    ],
    "look": {
      "template": "pill",
      "layout": "icon",
      "align": "center",
      "label": "",
      "vertical": false,
      "size": "medium",
      "size_mobile": "inherit",
      "color": "",
      "ink": ""
    },
    "services": [
      {
        "slug": "x",
        "label": "X",
        "color": "#000000",
        "accessibleColor": "#000000",
        "example": "@yourname"
      }
    ],
    "feed": "https://your-site.example/feed/"
  }
}
Field Type Meaning
data.profiles[].url string The full profile address, made from what you sent
data.look object The look as saved, every field filled in

Errors

Status Code When
400 plugixa_social_share_follow_invalid A value is not an address or name on its service. data.field names the service slug.
400 rest_missing_callback_param profiles is missing.
404 rest_no_route Follow buttons are switched off.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-social-share/v1/follow" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"profiles":[{"service":"instagram","value":"@yourname"},{"service":"x","value":"https://x.com/yourname"}],"look":{"template":"pill","layout":"icon","align":"center"}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-social-share/v1/follow');
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([
        'profiles' => [
            [
                'service' => 'instagram',
                'value'   => '@yourname',
            ],
            [
                'service' => 'x',
                'value'   => 'https://x.com/yourname',
            ],
        ],
        'look'     => [
            'template' => 'pill',
            'layout'   => 'icon',
            'align'    => 'center',
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-social-share/v1/follow', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ profiles: [{ service: 'instagram', value: '@yourname' }, { service: 'x', value: 'https://x.com/yourname' }], look: { template: 'pill', layout: 'icon', align: 'center' } }),
});
const { data } = await response.json();

Quick Links

Share