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的已排程貼文都可以被刪除。 - 除了 Instagram 與 TikTok 之外,所有社群網路
platforms的已發布貼文 都可以被刪除。Instagram 與 TikTok 並未提供刪除已發布貼文的 API 支援。如果你 需要在這些平台上刪除已發布的貼文,必須透過各平台的行動 App 手動刪除。 - Facebook 不允許透過 API 刪除圖片 story(影片 story 可以刪除)。如果你 需要刪除圖片 story,請開啟 Facebook 行動 App 手動刪除。
Instagram 與 TikTok 不支援透過 API 刪除貼文。請開啟
Instagram 或 TikTok 的行動 App 進行刪除。Facebook 不支援透過 API 刪除圖片 story。請開啟
Facebook 行動 App 進行刪除。
Header 參數
Body 參數
要刪除的貼文的 Ayrshare Post ID。若已傳送
bulk 或 deleteAllScheduled 參數則非必填。如果貼文為已排程且仍處於 pending 狀態,則該排程貼文會被刪除,且不會發布到各平台。如果貼文已發布到各平台,則會從各平台上刪除。要批次刪除的貼文 ID 字串陣列。若未傳送
id 或 deleteAllScheduled 參數則為必填。若設為
true,會刪除該 User Profile 下所有仍處於 pending 狀態的排程貼文(即尚未發布到各平台的貼文)。若設為 true,id 與 bulk 參數會被忽略。這會刪除所有排程貼文,請務必謹慎使用。
若設為
true,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
