curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "Spring promo (updated)",
"active": true,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring"
}
]
}' \
-X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";
fetch(`https://api.ayrshare.com/api/automations/${id}`, {
method: "PUT",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Spring promo (updated)",
active: true,
actions: [
{
type: "send_dm",
message: "Hey {{recipient_username}}! New link: https://example.com/spring",
},
],
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
"Authorization": "Bearer API_KEY",
"Content-Type": "application/json",
}
automation_id = "auto_9xKp2Lm4nQ"
payload = {
"name": "Spring promo (updated)",
"active": True,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring",
}
],
}
r = requests.put(
f"https://api.ayrshare.com/api/automations/{automation_id}",
json=payload,
headers=headers,
)
print(r.json())
$id = "auto_9xKp2Lm4nQ";
$data = [
"name" => "Spring promo (updated)",
"active" => true,
"actions" => [
[
"type" => "send_dm",
"message" => "Hey {{recipient_username}}! New link: https://example.com/spring",
],
],
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY",
"Content-Type: application/json",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"status": "success",
"id": "auto_9xKp2Lm4nQ"
}
{
"action": "request",
"status": "error",
"code": 473,
"message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction",
"details": {
"formErrors": ["Unrecognized key: \"platform\""],
"fieldErrors": {}
}
}
{
"action": "automation",
"status": "error",
"code": 469,
"message": "Automation not found"
}
{
"action": "automation",
"status": "error",
"code": 470,
"message": "Active automation limit reached for your plan tier"
}
Automations
自動化の更新
既存の自動化を更新します
PUT
/
automations
/
:id
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "Spring promo (updated)",
"active": true,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring"
}
]
}' \
-X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";
fetch(`https://api.ayrshare.com/api/automations/${id}`, {
method: "PUT",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Spring promo (updated)",
active: true,
actions: [
{
type: "send_dm",
message: "Hey {{recipient_username}}! New link: https://example.com/spring",
},
],
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
"Authorization": "Bearer API_KEY",
"Content-Type": "application/json",
}
automation_id = "auto_9xKp2Lm4nQ"
payload = {
"name": "Spring promo (updated)",
"active": True,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring",
}
],
}
r = requests.put(
f"https://api.ayrshare.com/api/automations/{automation_id}",
json=payload,
headers=headers,
)
print(r.json())
$id = "auto_9xKp2Lm4nQ";
$data = [
"name" => "Spring promo (updated)",
"active" => true,
"actions" => [
[
"type" => "send_dm",
"message" => "Hey {{recipient_username}}! New link: https://example.com/spring",
],
],
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY",
"Content-Type: application/json",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"status": "success",
"id": "auto_9xKp2Lm4nQ"
}
{
"action": "request",
"status": "error",
"code": 473,
"message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction",
"details": {
"formErrors": ["Unrecognized key: \"platform\""],
"fieldErrors": {}
}
}
{
"action": "automation",
"status": "error",
"code": 469,
"message": "Automation not found"
}
{
"action": "automation",
"status": "error",
"code": 470,
"message": "Active automation limit reached for your plan tier"
}
ベータ版。機能の詳細については Automations Overview を参照してください。
platform、accountId)を送信するとバリデーションエラーとして拒否されます。
triggers または actions を送信すると、既存の子要素はアトミックに 置き換え られます:単一の Firestore トランザクション内で古いセットが削除され、新しいセットが書き込まれます。1 つのトリガーだけを変更する場合でも、完全な新しい配列を送信する必要があります。
以前非アクティブだった自動化を再有効化する場合(active: true)、アクティブキャップが再チェックされます。すでに上限に達している場合、更新はコード 470 で失敗し、変更は行われません。
Header Parameters
Path Parameters
POST /automations から返される自動化 ID。Body Parameters
新しい名前。
新しい説明。
自動化のオン/オフを切り替えます。
false から true に設定すると、アクティブ自動化キャップが再チェックされます。トリガーの完全な置換セット(1〜50 件)。作成エンドポイントと同じ形式です。
アクションの完全な置換セット(1〜50 件)。作成エンドポイントと同じ形式です。
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "Spring promo (updated)",
"active": true,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring"
}
]
}' \
-X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";
fetch(`https://api.ayrshare.com/api/automations/${id}`, {
method: "PUT",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Spring promo (updated)",
active: true,
actions: [
{
type: "send_dm",
message: "Hey {{recipient_username}}! New link: https://example.com/spring",
},
],
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
"Authorization": "Bearer API_KEY",
"Content-Type": "application/json",
}
automation_id = "auto_9xKp2Lm4nQ"
payload = {
"name": "Spring promo (updated)",
"active": True,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring",
}
],
}
r = requests.put(
f"https://api.ayrshare.com/api/automations/{automation_id}",
json=payload,
headers=headers,
)
print(r.json())
$id = "auto_9xKp2Lm4nQ";
$data = [
"name" => "Spring promo (updated)",
"active" => true,
"actions" => [
[
"type" => "send_dm",
"message" => "Hey {{recipient_username}}! New link: https://example.com/spring",
],
],
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY",
"Content-Type: application/json",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"status": "success",
"id": "auto_9xKp2Lm4nQ"
}
{
"action": "request",
"status": "error",
"code": 473,
"message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction",
"details": {
"formErrors": ["Unrecognized key: \"platform\""],
"fieldErrors": {}
}
}
{
"action": "automation",
"status": "error",
"code": 469,
"message": "Automation not found"
}
{
"action": "automation",
"status": "error",
"code": 470,
"message": "Active automation limit reached for your plan tier"
}
⌘I
