Contents
Record Click - Plugixa Easy Social Share Buttons
POST /plugixa-social-share/v1/click
Record one click on a share button. This is the beacon the buttons send; it feeds click counts and Share analytics.
Public: no login, no nonce and no Application Password. It is meant to be called from the visitor’s browser on a cached page.
A click is recorded only when share buttons are switched on, network is a network the plugin knows, placement is empty, a registered position or manual, the post exists and is published, and the caller is within 60 requests a minute. The limit is counted against a salted hash of the caller’s IP address, kept for one minute; the address itself is never stored.
Note. The answer is
204 No Contentwhatever happens, recorded or not, so a script cannot tell whether a click counted. While share buttons are on, every request counts toward the limit, rejected ones included. When the server sees no IP address at all, no limit applies.
Request
POST https://your-site.example/wp-json/plugixa-social-share/v1/click
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
network |
string |
Yes | The network slug, such as x. |
post |
integer |
No | The post’s ID. Default 0, which records nothing: in practice it is needed. |
placement |
string |
No | Where the button was: a position slug such as content_bottom, or manual. Default empty. |
The fields can also be sent as form fields or in the query string.
{
"network": "x",
"post": 123,
"placement": "content_bottom"
}
Responses
204 No Content. There is no body.
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_missing_callback_param |
network is missing. |
404 |
rest_no_route |
Share counts are switched off, so the route is not registered. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-social-share/v1/click" \
-H "Content-Type: application/json" \
-d '{"network":"x","post":123,"placement":"content_bottom"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-social-share/v1/click');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'network' => 'x',
'post' => 123,
'placement' => 'content_bottom',
]),
]);
curl_exec($ch); // 204 No Content: there is no body to read.
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-social-share/v1/click', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ network: 'x', post: 123, placement: 'content_bottom' }),
});
// 204 No Content: there is no body to read.
Quick Links
Share