curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"id": "Post ID"}' \
-X DELETE https://api.ayrshare.com/api/post
const API_KEY = "API_KEY";
const id = "Post ID";
fetch("https://api.ayrshare.com/api/post", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({ id }),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'id': 'Post ID'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.delete('https://api.ayrshare.com/api/post',
json=payload,
headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/post';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$postId = '7NFVK0QIXET5rCUS9tmf'; // Replace with your actual post ID
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$data = json_encode(['id' => $postId]);
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $data
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace DeletePOSTRequest_csharp
{
class Delete
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = "{\"id\" : \"Post ID\"}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Create and send DELETE request with content
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri(url),
Content = content
};
HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"twitter": {
"action": "delete",
"status": "success",
"id": "1288900099663775749" // Twitter Social Post ID
},
"facebook": {
"action": "delete",
"status": "success",
"id": "104920007983682_108683297607743" // Facebook Social PostID
},
"status": "success"
}
{
"status": "success",
"id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
{
"action": "delete",
"status": "error",
"code": 114,
"message": "Delete id not found.",
"id": "IdpUOyihLEpIx0d0N9mI" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
{
"action": "delete",
"status": "error",
"code": 383,
"message": "The post is already deleted.",
"id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
{
"action": "delete",
"status": "error",
"code": 382,
"message": "The post was not manually deleted at the social network. By using the markManualDeleted option, you are responsible for deleting the post at the social network. Please delete the post and try again.",
"id": "DD3fA2DC4qe2T48hSdgs",
"markManualDeleted": true
}
Post
删除帖子
使用帖子 ID 删除帖子
DELETE
/
post
curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"id": "Post ID"}' \
-X DELETE https://api.ayrshare.com/api/post
const API_KEY = "API_KEY";
const id = "Post ID";
fetch("https://api.ayrshare.com/api/post", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({ id }),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'id': 'Post ID'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.delete('https://api.ayrshare.com/api/post',
json=payload,
headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/post';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$postId = '7NFVK0QIXET5rCUS9tmf'; // Replace with your actual post ID
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$data = json_encode(['id' => $postId]);
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $data
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace DeletePOSTRequest_csharp
{
class Delete
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = "{\"id\" : \"Post ID\"}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Create and send DELETE request with content
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri(url),
Content = content
};
HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"twitter": {
"action": "delete",
"status": "success",
"id": "1288900099663775749" // Twitter Social Post ID
},
"facebook": {
"action": "delete",
"status": "success",
"id": "104920007983682_108683297607743" // Facebook Social PostID
},
"status": "success"
}
{
"status": "success",
"id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
{
"action": "delete",
"status": "error",
"code": 114,
"message": "Delete id not found.",
"id": "IdpUOyihLEpIx0d0N9mI" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
{
"action": "delete",
"status": "error",
"code": 383,
"message": "The post is already deleted.",
"id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
{
"action": "delete",
"status": "error",
"code": 382,
"message": "The post was not manually deleted at the social network. By using the markManualDeleted option, you are responsible for deleting the post at the social network. Please delete the post and try again.",
"id": "DD3fA2DC4qe2T48hSdgs",
"markManualDeleted": true
}
使用 /post 端点返回的帖子 ID 删除帖子。
你可以删除已发布和已安排的帖子,但根据社交网络
platform 的不同存在一些差异:
- 所有社交网络
platforms上的已安排帖子都可以删除。 - 所有社交网络
platforms上的已发布帖子都可以删除, Instagram 和 TikTok 除外。Instagram 和 TikTok 不通过 API 支持 删除已发布的帖子。如果你需要在这些平台上删除已发布的帖子, 必须使用它们各自的移动应用程序手动删除。 - Facebook 不允许通过其 API 删除图片故事(视频故事 可以删除)。如果你需要删除图片故事,请前往 Facebook 移动应用手动执行删除。
Instagram 和 TikTok 不支持通过 API 删除。请前往
Instagram 或 TikTok 的移动应用程序删除帖子。Facebook 不支持通过其 API 删除图片故事。请前往
Facebook 移动应用程序删除故事。
Header 参数
Body 参数
要删除的帖子的 Ayrshare Post ID。如果发送了
bulk 或 deleteAllScheduled 参数,则不需要此参数。如果帖子已安排且仍处于 pending 状态,已安排的帖子将被删除,不会发送到社交网络。如果帖子已发送到社交网络,则将从这些网络中删除该帖子。用于批量删除的帖子 ID 字符串数组。如果未发送
id 或 deleteAllScheduled 参数,则必填。如果为
true,将删除该用户配置文件中所有仍处于待处理状态(即尚未发布到社交网络)的已安排帖子。如果设为 true,则忽略 id 或 bulk 参数。这将删除所有已安排的帖子,因此使用时请务必谨慎。
如果为
true,该帖子将在 Ayrshare 中被标记为已删除,且 Ayrshare 不会尝试在社交网络上删除该帖子。一个常见用例是:当帖子已在社交网络上手动删除,你希望在 Ayrshare 中将其标记为已删除。在将帖子标记为已删除之前,请确保该帖子已在社交网络上手动删除。curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"id": "Post ID"}' \
-X DELETE https://api.ayrshare.com/api/post
const API_KEY = "API_KEY";
const id = "Post ID";
fetch("https://api.ayrshare.com/api/post", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({ id }),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'id': 'Post ID'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.delete('https://api.ayrshare.com/api/post',
json=payload,
headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/post';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$postId = '7NFVK0QIXET5rCUS9tmf'; // Replace with your actual post ID
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$data = json_encode(['id' => $postId]);
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $data
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace DeletePOSTRequest_csharp
{
class Delete
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = "{\"id\" : \"Post ID\"}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Create and send DELETE request with content
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri(url),
Content = content
};
HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"twitter": {
"action": "delete",
"status": "success",
"id": "1288900099663775749" // Twitter Social Post ID
},
"facebook": {
"action": "delete",
"status": "success",
"id": "104920007983682_108683297607743" // Facebook Social PostID
},
"status": "success"
}
{
"status": "success",
"id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
{
"action": "delete",
"status": "error",
"code": 114,
"message": "Delete id not found.",
"id": "IdpUOyihLEpIx0d0N9mI" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
{
"action": "delete",
"status": "error",
"code": 383,
"message": "The post is already deleted.",
"id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
{
"action": "delete",
"status": "error",
"code": 382,
"message": "The post was not manually deleted at the social network. By using the markManualDeleted option, you are responsible for deleting the post at the social network. Please delete the post and try again.",
"id": "DD3fA2DC4qe2T48hSdgs",
"markManualDeleted": true
}
⌘I
