POST/api/v4/social/bulk-posts

إنشاء منشورات دفعة واحدة

يتحقق من صلاحية حتى 500 منشور على وسائل التواصل الاجتماعي ويضعها في قائمة الانتظار بطلب واحد، ويعيد مهمة للاستعلام الدوري عن نتائج كل صف.

يتطلب مفتاح API. راجع المصادقة لمعرفة تنسيق الترويسة وتدوير المفاتيح.

المعلمات

النص الأساسي

ينطبق الحقل المتداخل المحدد على أنه مطلوب فقط عند إرسال الحقل الأصل. إذا كان الحقل الأصل اختياريًا وحذفته، فلا تنطبق حقوله الفرعية المطلوبة.

الاسمالنوعمطلوبالوصف
inputobjectمطلوبWrapper object. The entire request body must be nested under `input`.
input.postsarray of objectsمطلوبThe rows to create, 1 to 500 of them. Each row is the same object POST /social/posts takes as its `input`; the per-row fields are listed below.
input.namestringاختياريOptional label for the job itself, to identify it in your own logs. Not shown to any audience.
input.posts[].socialProfileIdstringمطلوبUUID of the brand publishing this row. Rows may target different brands in one request.
input.posts[].namestringمطلوبInternal name for the post.
input.posts[].platformsarray of stringsمطلوبPlatforms for this row: `FACEBOOK`, `INSTAGRAM`, `TWITTER` (X), `LINKEDIN`, `PINTEREST`. Each must already have a connection on that row's brand.
input.posts[].contentstringمطلوبThe post body.
input.posts[].actionstringمطلوب`DRAFT`, `SCHEDULE` (requires a schedule) or `PUBLISH`.
input.posts[].mediaUrlsarray of stringsاختياريPublic https image URLs. Required when the row targets Instagram or Pinterest.
input.posts[].videoUrlsarray of stringsاختياريPublic https video URLs.
input.posts[].linkstringاختياريLink to attach where the platform supports one.
input.posts[].scheduledAtstringاختياريISO-8601 publish instant with an offset. Alternative to `scheduleDate` + `scheduleTime`, never both.
input.posts[].scheduleDatestringاختياري`YYYY-MM-DD`, interpreted in that row's brand timezone. Send with `scheduleTime`.
input.posts[].scheduleTimestringاختياري`HH:MM`, interpreted in that row's brand timezone. Send with `scheduleDate`.
input.posts[].connectedChannelIdsarray of stringsاختياريRestrict this row to specific connections by ID.
input.posts[].clientReferencestringاختياريYour own identifier for this row, echoed back on the matching job result. The most reliable way to reconcile a batch against your own records.

مثال على الطلب

نص جاهز للصق. استبدل المعرّفات والقيم النموذجية بقيمك.

Request body
{  "input": {    "name": "Autumn campaign load",    "posts": [      {        "socialProfileId": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",        "name": "Autumn week 1",        "platforms": ["INSTAGRAM", "FACEBOOK"],        "content": "Week one of the autumn collection: the Fairfield oak sideboard, finished by hand in the workshop.",        "mediaUrls": ["https://cdn.example.com/social/autumn-w1.jpg"],        "action": "SCHEDULE",        "scheduleDate": "2026-10-02",        "scheduleTime": "09:30",        "clientReference": "campaign-4471-slot-01"      },      {        "socialProfileId": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",        "name": "Autumn week 2",        "platforms": ["INSTAGRAM", "FACEBOOK", "LINKEDIN"],        "content": "Week two: the Halcyon armchair. Sixty hours of work, one chair.",        "mediaUrls": ["https://cdn.example.com/social/autumn-w2.jpg"],        "action": "SCHEDULE",        "scheduleDate": "2026-10-09",        "scheduleTime": "09:30",        "clientReference": "campaign-4471-slot-02"      },      {        "socialProfileId": "a90f7c22-5db1-4e83-9f40-2b7c6a1e5d33",        "name": "Eastside autumn teaser",        "platforms": ["INSTAGRAM"],        "content": "Something solid is arriving next week. Stay tuned.",        "mediaUrls": ["https://cdn.example.com/social/eastside-teaser.jpg"],        "action": "SCHEDULE",        "scheduledAt": "2026-10-01T08:00:00-04:00",        "clientReference": "campaign-4471-slot-03"      }    ]  }}

الاستجابات

200The whole batch validated. A job was queued, poll GET /social/bulk-posts/{bulkJobId} for per-row results.
Response
{  "data": {    "createBulkSocialMediaPosts": {      "success": true,      "error": [],      "job": {        "id": "9b3f18d0-7a26-4c51-8e94-1f0d5c6b7a82",        "status": "QUEUED",        "totalCount": 3,        "processedCount": 0,        "successCount": 0,        "failureCount": 0,        "createdAt": "2026-09-28T14:04:52Z",        "updatedAt": "2026-09-28T14:04:52Z",        "results": []      }    }  }}
200At least one row failed validation, so **nothing was created**. `success` is `false`, no job is returned, and each rejected row is reported with its 0-based `index`.
Response
{  "data": {    "createBulkSocialMediaPosts": {      "success": false,      "error": [        {          "message": "SY95050: Bulk validation failed, no posts were created",          "code": "SY95050",          "contextInfo": null        }      ],      "job": {        "id": null,        "status": "FAILED",        "totalCount": 3,        "processedCount": 0,        "successCount": 0,        "failureCount": 2,        "createdAt": "2026-09-28T14:04:52Z",        "updatedAt": "2026-09-28T14:04:52Z",        "results": [          {            "index": 1,            "clientReference": "campaign-4471-slot-02",            "socialProfileId": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",            "platforms": ["INSTAGRAM", "FACEBOOK", "LINKEDIN"],            "status": "INVALID",            "socialPostId": null,            "postStatus": null,            "errors": [              {                "message": "SY95045: No connected channel for LINKEDIN on this brand",                "code": "SY95045",                "contextInfo": [{ "key": "platform", "value": "LINKEDIN" }]              }            ]          },          {            "index": 2,            "clientReference": "campaign-4471-slot-03",            "socialProfileId": "a90f7c22-5db1-4e83-9f40-2b7c6a1e5d33",            "platforms": ["INSTAGRAM"],            "status": "INVALID",            "socialPostId": null,            "postStatus": null,            "errors": [              {                "message": "SY95046: scheduledAt must carry a UTC offset",                "code": "SY95046",                "contextInfo": null              }            ]          }        ]      }    }  }}
401Unauthenticated, missing or invalid API key.

ينشئ عدة منشورات على وسائل التواصل الاجتماعي في طلب واحد. تُرسَل الصفوف ضمن حمولة الطلب — لا يوجد رفع ملفات ولا CSV، بل مجرد مصفوفة من الكائنات نفسها التي يقبلها POST /social/posts واحدًا في كل مرة. بحد أقصى 500 صف لكل طلب.

حالة استخدام: تحميل محتوى ربع سنة في استدعاء واحد. تحتوي أداة التخطيط لديك على تقويم المحتوى الكامل للعميل. أنشئ صفًا لكل موعد نشر، وميّز كل صف بقيمة clientReference الخاصة بك، وأرسلها معًا. إما أن تنجح الدفعة كوحدة واحدة أو أن تحدد لك بدقة الصفوف التي تحتاج إلى إصلاح. خزّن job.id المُعاد واستعلم دوريًا عن GET /social/bulk-posts/{bulkJobId} حتى يصل status إلى حالة نهائية، ثم طابق كل نتيجة باستخدام clientReference الخاص بها.

يجري التحقق من صلاحية الدفعة بأكملها مسبقًا

يجري التحقق من صلاحية كل صف قبل إنشاء أي شيء، وتُعامل الدفعة كوحدة غير قابلة للتجزئة في تلك المرحلة:

  • إذا كان أي صف غير صالح، فلن يُنشأ أي شيء. تكون قيمة success هي false، ويُعاد SY95050 في error، ويظهر كل صف غير صالح في job.results[] مع index الخاص به الذي يبدأ ترقيمه من 0، وclientReference الخاص به، والسبب في errors[]. أصلح تلك الصفوف وأعد إرسال الدفعة بأكملها.
  • إذا كانت جميع الصفوف صالحة، تُدرَج مهمة في قائمة الانتظار، وتكون قيمة success هي true، وتحصل على job.id. قد تظل بعض الصفوف تفشل لاحقًا عندما ترفضها المنصة وقت النشر؛ ويظهر ذلك في المهمة، وليس هنا.

طابق النتائج باستخدام clientReference حيثما أمكن، وباستخدام index فيما عدا ذلك — لا تُعاد الصفوف نفسها في الاستجابة، لذا فإن هذين الحقلين هما الرابط الوحيد ببياناتك.

ملاحظات.

  • يجب تغليف جسم الطلب داخل كائن input، مع وضع الصفوف في input.posts.
  • تحقق من success، وليس من حالة HTTP. يُعاد رفض الدفعة بأكملها على هيئة HTTP 200 مع success: false وSY95050 في error.
  • الحد الأقصى هو 500 صف لكل طلب. تُرفض أي مصفوفة أكبر من ذلك مباشرةً مع SY95048 ولا يُنشأ أي شيء؛ قسّمها وأرسلها على عدة دفعات.
  • تُحدَّد العلامة التجارية في كل صف بواسطة socialProfileId. لا يُستخدم brandId إلا كرمز في مسار URL، ولا يحتوي هذا المسار على أي رمز مسار أصلًا.
  • يمكن أن تستهدف الصفوف علامات تجارية مختلفة. يجري التحقق من platforms لكل صف بالرجوع إلى العلامة التجارية الخاصة بذلك الصف، لذا فإن اتصال منصة بعلامة تجارية وعدم اتصالها بأخرى يؤدي إلى فشل الصفوف التي تحتاج إليها فقط.
  • يتبع كل صف قواعد الجدولة نفسها المتبعة لمنشور واحد: scheduledAt أو scheduleDate + scheduleTime، ولا يجوز الجمع بينهما مطلقًا، وتُقرأ قيم scheduleDate / scheduleTime وفق المنطقة الزمنية للعلامة التجارية الخاصة بذلك الصف. يمكن استخدام الصيغتين في صفوف مختلفة ضمن دفعة واحدة.
  • تنطبق حدود معدل الطلبات على الطلب، وليس على الصفوف: تُحتسب دفعة من 500 صف كطلب واحد من حصتك. راجع حدود معدل الطلبات.

عملية كتابة: لم تُنفَّذ على الحساب الفعلي. بُني الطلب والاستجابة المعروضان استنادًا إلى مخطط API؛ وتؤدي هذه العملية عند تشغيلها إلى النشر على حسابات فعلية على وسائل التواصل الاجتماعي.

Request
curl -X POST 'https://listingsapi.com/api/v4/social/bulk-posts' \  -H "Authorization: API $LISTINGSAPI_KEY" \  -H 'Content-Type: application/json' \  -d '{    "input": {      "name": "Autumn campaign load",      "posts": [        {          "socialProfileId": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",          "name": "Autumn week 1",          "platforms": [            "INSTAGRAM",            "FACEBOOK"          ],          "content": "Week one of the autumn collection: the Fairfield oak sideboard, finished by hand in the workshop.",          "mediaUrls": [            "https://cdn.example.com/social/autumn-w1.jpg"          ],          "action": "SCHEDULE",          "scheduleDate": "2026-10-02",          "scheduleTime": "09:30",          "clientReference": "campaign-4471-slot-01"        },        {          "socialProfileId": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",          "name": "Autumn week 2",          "platforms": [            "INSTAGRAM",            "FACEBOOK",            "LINKEDIN"          ],          "content": "Week two: the Halcyon armchair. Sixty hours of work, one chair.",          "mediaUrls": [            "https://cdn.example.com/social/autumn-w2.jpg"          ],          "action": "SCHEDULE",          "scheduleDate": "2026-10-09",          "scheduleTime": "09:30",          "clientReference": "campaign-4471-slot-02"        },        {          "socialProfileId": "a90f7c22-5db1-4e83-9f40-2b7c6a1e5d33",          "name": "Eastside autumn teaser",          "platforms": [            "INSTAGRAM"          ],          "content": "Something solid is arriving next week. Stay tuned.",          "mediaUrls": [            "https://cdn.example.com/social/eastside-teaser.jpg"          ],          "action": "SCHEDULE",          "scheduledAt": "2026-10-01T08:00:00-04:00",          "clientReference": "campaign-4471-slot-03"        }      ]    }  }'