- Basic Information Terminology, getting started and setting up your account. Recommended for new customers.
- Make your website social Step-by-step tutorials and information on how to integrate our plugins and services to your site.
- REST API Reference JSON/REST API for advanced social network integration. Must-read for developers.
Social Sharing API \ Delete a message
Send a DELETE request to this resource to permanently delete an existing sharing message. Please
note that the message will not be removed from the social networks.
| Social Sharing API Resources/URI | GET | POST | PUT | DELETE |
Sharing Messages /sharing/messages.<format> |
List published messages | Publish a new message | – | – |
Sharing Message /sharing/messages/<sharing_message_token>.<format> |
Get message details | Re-Publish a message | – | Delete a message |
Workflow
1. Request: the code to send to the API
Send a DELETE request to the resource /sharing/messages/<sharing_message_token>.<format>
to delete a previously created sharing message.
To prevent you from unintentionally deleting a sharing message by mixing up the DELETE/GET methods
you have to include the url parameter confirm_deletion=true in your DELETE requests (code example).
If you omit this parameter, the message will not be removed and an error will be thrown.
2. Result: the code returned by the API
If the message has been deleted successfully, the API will return an empty message with a HTTP Status Code 200. If the message could not be deleted, the API will return a HTTP Status Code other than 200 and an appropriate message body with further details on the error that occured.
Code Example
Sending a GET request with the confirm_deletion argument to remove a sharing message
<?php
//NOTE: Replace the #placeholders# with your own values
//The sharing_message_token
$sharing_message_token = '#<sharing_message_token>#';
//Your Site API Credentials
$site_subdomain = '#site subdomain#';
$site_public_key = '#site public key/username#';
$site_private_key = '#site private key/password#';
//The resource to send the request to
//Please note the ?confirm_deletion=true argument in the resource uri
$api_resource_uri = 'https://' . $site_subdomain . ".api.oneall.com/sharing/messages/" . $sharing_message_token . ".json?confirm_deletion=true";
//Setup CURL
$curl = curl_init ();
curl_setopt ($curl, CURLOPT_URL, $api_resource_uri);
curl_setopt ($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt ($curl, CURLOPT_USERPWD, $site_public_key . ":" . $site_private_key);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
//Send Request
$json = curl_exec ($curl);
//Could not execute request
if ($json === false)
{
echo 'CURL error: ' . curl_error ($curl);
}
//Request executed
else
{
//Retrieve HTTP Code
$http_code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
//Success
if ($http_code == 200)
{
echo "Message " . $sharing_message_token . " deleted";
}
//Error
else
{
echo "Message " . $sharing_message_token . " has not been deleted, HTTP Code " . $http_code . " received\n";
echo "Result: " . print_r(json_decode($json), true) . "\n";
}
}
//Close connection
curl_close ($curl);
?>