curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/delegations \
-d '{"owners": [{"refId": "140b8709bd6ade099b242d895e268fb886130c53"}], "platforms": ["instagram"]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/delegations", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
owners: [{ refId: "140b8709bd6ade099b242d895e268fb886130c53" }],
platforms: ["instagram"]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
{
"status": "success",
"delegations": [
{
"id": "Kx3v9QpL2mZ7tR1wYb4N",
"owner": { "refId": "140b8709bd6ade099b242d895e268fb886130c53", "title": "Agent One" },
"payer": { "refId": "9f1c3e7a2b4d", "title": "Agency" },
"platform": "instagram",
"permission": "unknown",
"status": "active"
}
]
}
{
"action": "ads",
"status": "error",
"code": 400,
"message": "These owner profiles are not found in this account: 140b8709bd6ade."
}
Boost on Behalf
إنشاء تفويضات التعزيز
اسمح لملف شخصي في حسابك، وهو الدافع، بتعزيز منشورات ملفات شخصية أخرى من حساب الإعلانات الخاص به. أرسل الطلب باستخدام API Key الخاص بـ Primary Profile.
POST
/
ads
/
delegations
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/delegations \
-d '{"owners": [{"refId": "140b8709bd6ade099b242d895e268fb886130c53"}], "platforms": ["instagram"]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/delegations", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
owners: [{ refId: "140b8709bd6ade099b242d895e268fb886130c53" }],
platforms: ["instagram"]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
{
"status": "success",
"delegations": [
{
"id": "Kx3v9QpL2mZ7tR1wYb4N",
"owner": { "refId": "140b8709bd6ade099b242d895e268fb886130c53", "title": "Agent One" },
"payer": { "refId": "9f1c3e7a2b4d", "title": "Agency" },
"platform": "instagram",
"permission": "unknown",
"status": "active"
}
]
}
{
"action": "ads",
"status": "error",
"code": 400,
"message": "These owner profiles are not found in this account: 140b8709bd6ade."
}
يتيح تفويض التعزيز لملف شخصي واحد في حسابك، وهو الدافع (payer)، تعزيز المنشورات التي نشرتها ملفات شخصية أخرى في حسابك. والدافع هو الملف الشخصي الذي يدفع حساب الإعلانات الخاص به تكلفة الإعلان.
تُدار التفويضات باستخدام API Key الخاص بـ Primary Profile لديك. أرسل الطلب بدون
يُشار إلى الملفات الشخصية بقيمة
Profile-Key.
معاملات الترويسة
معاملات الجسم
ملفات User Profile (ملفات المستخدمين الشخصية) التي يمكن للدافع تعزيز منشوراتها. إما قائمة تضم حتى 1,000 كائن يحتوي كل منها على
refId، أو "all" لكل User Profile موجود في حسابك حاليًا، باستثناء الدافع. لا يمكن أن يكون Primary Profile مالكًا (owner).يشمل حد الـ 1,000 القيمة "all" أيضًا: إذا كان حسابك يضم أكثر من 1,000 User Profile إلى جانب الدافع، يُرفض الطلب بالرمز code 101 ولا يُنشأ أي شيء. أرسل owners بدلًا من ذلك في قوائم تضم حتى 1,000 ملف شخصي لكل طلب.لا تشمل "all" الملفات الشخصية التي تنشئها لاحقًا. أرسل الطلب مرة أخرى لإضافتها.منصات الإعلانات المراد تفويضها، على سبيل المثال
["instagram"]. لا تُقبل إلا الشبكات التي تدعم الترويج نيابةً عن الآخرين؛ وأي شبكة أخرى تُرجع 101. تحصل على تفويض واحد
لكل مالك ومنصة.refId المُعادة عند إنشاء ملف شخصي أو الحصول على الملفات الشخصية.
يحصل كل مالك ومنصة على تفويض خاص به، له id خاص. يؤدي إرسال الطلب مرة أخرى إلى إنشاء التفويضات المفقودة فقط، ويُعيد التفويضات الموجودة دون تغيير. باستثناء حالة واحدة: إذا رفض المالك الإذن على الشبكة، تعود قيمة permission للتفويض إلى unknown، لكي يطلب التعزيز التالي الإذن مجددًا. أرسل الطلب بعد أن يعيد المالك ربط الحساب. ويعود التفويض المُلغى لمالك ومنصة مُدرجين في هذا الطلب نشطًا مرة أخرى بالمعرّف id نفسه؛ أما المنصات المُلغاة الأخرى للمالك فتظل مُلغاة.
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/delegations \
-d '{"owners": [{"refId": "140b8709bd6ade099b242d895e268fb886130c53"}], "platforms": ["instagram"]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/delegations", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
owners: [{ refId: "140b8709bd6ade099b242d895e268fb886130c53" }],
platforms: ["instagram"]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
{
"status": "success",
"delegations": [
{
"id": "Kx3v9QpL2mZ7tR1wYb4N",
"owner": { "refId": "140b8709bd6ade099b242d895e268fb886130c53", "title": "Agent One" },
"payer": { "refId": "9f1c3e7a2b4d", "title": "Agency" },
"platform": "instagram",
"permission": "unknown",
"status": "active"
}
]
}
{
"action": "ads",
"status": "error",
"code": 400,
"message": "These owner profiles are not found in this account: 140b8709bd6ade."
}