תזמון ופרסום
שמירת טיוטה חדשה בסביבת העבודה
שמרו טיוטה משותפת חדשה בסביבת העבודה עם workspace_id, ערך id ייחודי שנוצר בלקוח, mutation_id ו-content. נדרשת דרגת editor ומעלה וכן גישת operate. החשבונות, הזמן והמדיה המוכנה יכולים להיות לא שלמים. השמירה אינה יוצרת Scheduled Post, עבודת ביצוע או שמירת קרדיט לפרסום, ואינה מבצעת קריאה לספק. תוכן של עורכים שותפים אינו מהימן והוא מוגבל. נסו שוב עם אותה זהות ואותו תוכן בדיוק; השתמשו ב-sosoapi_update_content_draft לעריכות מאוחרות יותר.
POST /studio-api/content-drafts/createהחוזה נבדק: · sha256:75c8b8ebce408575
סקירה
שמרו טיוטה משותפת חדשה בסביבת העבודה עם workspace_id, ערך id ייחודי שנוצר בלקוח, mutation_id ו-content. נדרשת דרגת editor ומעלה וכן גישת operate. החשבונות, הזמן והמדיה המוכנה יכולים להיות לא שלמים. השמירה אינה יוצרת Scheduled Post, עבודת ביצוע או שמירת קרדיט לפרסום, ואינה מבצעת קריאה לספק. תוכן של עורכים שותפים אינו מהימן והוא מוגבל. נסו שוב עם אותה זהות ואותו תוכן בדיוק; השתמשו ב-sosoapi_update_content_draft לעריכות מאוחרות יותר.
תגובת HTTP מוצלחת עשויה לציין שבקשה התקבלה, ולא שהושלמה. בעבודת רקע, שמרו את המזהה שהוחזר ובדקו את אותה פעולה עד שתסתיים. פוסט שתוזמן או התקבל נחשב שפורסם רק כשהפלטפורמה מאשרת זאת; חריגה מזמן ההמתנה אצל הלקוח אינה קובעת מה התוצאה.
אימות והרשאות
אסימון יכול להשתמש רק בזכויות שיש לבעליו. כל בקשה בודקת חברות בסביבת העבודה, בעלות על משאבים, סביבות עבודה נבחרות ויכולות שהוענקו. הפרופילים core ו-full משנים אילו כלים מוצגים; הם אינם מעניקים גישה.
שדות הבקשה
שדה חובה נדרש בתוך אובייקט האב והענף הנבחר שלו. צאצא נדרש אינו הופך אב אופציונלי לנדרש. הכללים ושמות השדות שלהלן מועתקים מהחוזה.
| שדה / ענף | סוג / חובה | אילוצים |
|---|---|---|
$ | objectחובה באובייקט האב |
|
workspace_id | stringחובה באובייקט האב |
|
id | stringחובה באובייקט האב |
|
mutation_id | stringחובה באובייקט האב |
|
content | objectחובה באובייקט האב |
|
content.schemaVersion | numberרשות / פריט |
|
content.accountIds | arrayרשות / פריט |
|
content.accountIds[] | stringרשות / פריט |
|
content.caption | stringרשות / פריט |
|
content.hashtags | stringרשות / פריט |
|
content.assetIds | arrayרשות / פריט |
|
content.assetIds[] | stringרשות / פריט |
|
content.threadsTextOnly | booleanרשות / פריט |
|
content.instagramMode | stringרשות / פריט |
|
content.youtubeTitle | stringרשות / פריט |
|
content.youtubePrivacy | stringרשות / פריט |
|
content.youtubeSynthetic | booleanרשות / פריט |
|
content.youtubeCategoryId | stringרשות / פריט |
|
content.youtubeShort | booleanרשות / פריט |
|
content.linkUrl | stringרשות / פריט |
|
content.scheduledAt | stringרשות / פריט |
|
content.displayTimezone | stringרשות / פריט |
|
content.publishNow | booleanרשות / פריט |
|
content.destinationOverrides | objectרשות / פריט |
|
content.destinationOverrides.* | objectרשות / פריט |
|
content.destinationOverrides.*.caption | stringרשות / פריט |
|
content.destinationOverrides.*.scheduledAt | stringרשות / פריט |
|
content.expiresAt | stringרשות / פריט |
|
JSON Schema מלא
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"workspace_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"mutation_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"content": {
"type": "object",
"properties": {
"schemaVersion": {
"default": 1,
"type": "number",
"const": 1
},
"accountIds": {
"default": [],
"maxItems": 50,
"type": "array",
"items": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
},
"caption": {
"default": "",
"type": "string",
"maxLength": 5000
},
"hashtags": {
"default": "",
"type": "string",
"maxLength": 5000
},
"assetIds": {
"default": [],
"maxItems": 20,
"type": "array",
"items": {
"type": "string",
"maxLength": 16,
"pattern": "^[1-9][0-9]*$"
}
},
"threadsTextOnly": {
"default": false,
"type": "boolean"
},
"instagramMode": {
"default": "REELS",
"type": "string",
"enum": [
"IMAGE",
"REELS",
"CAROUSEL",
"STORY_IMAGE",
"STORY_VIDEO"
]
},
"youtubeTitle": {
"default": "",
"type": "string",
"maxLength": 100
},
"youtubePrivacy": {
"default": "private",
"type": "string",
"enum": [
"private",
"unlisted",
"public"
]
},
"youtubeSynthetic": {
"default": false,
"type": "boolean"
},
"youtubeCategoryId": {
"default": "",
"type": "string",
"maxLength": 32
},
"youtubeShort": {
"default": false,
"type": "boolean"
},
"linkUrl": {
"default": "",
"type": "string",
"maxLength": 2048
},
"scheduledAt": {
"default": "",
"type": "string",
"maxLength": 64
},
"displayTimezone": {
"default": "UTC",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"publishNow": {
"default": false,
"type": "boolean"
},
"destinationOverrides": {
"default": {},
"type": "object",
"propertyNames": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"additionalProperties": {
"type": "object",
"properties": {
"caption": {
"type": "string",
"maxLength": 5000
},
"scheduledAt": {
"type": "string",
"maxLength": 64
}
},
"additionalProperties": false
}
},
"expiresAt": {
"default": "",
"type": "string",
"maxLength": 64
}
},
"additionalProperties": false
}
},
"required": [
"workspace_id",
"id",
"mutation_id",
"content"
],
"additionalProperties": false
}תגובה והשלמה
סטטוסי HTTP להצלחה: 200. מתי הפעולה הושלמה: durable Workspace editorial content; no publishing side effects.
תגובת HTTP מוצלחת עשויה לציין שבקשה התקבלה, ולא שהושלמה. בעבודת רקע, שמרו את המזהה שהוחזר ובדקו את אותה פעולה עד שתסתיים. פוסט שתוזמן או התקבל נחשב שפורסם רק כשהפלטפורמה מאשרת זאת; חריגה מזמן ההמתנה אצל הלקוח אינה קובעת מה התוצאה.
שדה חובה נדרש בתוך אובייקט האב והענף הנבחר שלו. צאצא נדרש אינו הופך אב אופציונלי לנדרש. הכללים ושמות השדות שלהלן מועתקים מהחוזה.
| שדה / ענף | סוג / חובה | אילוצים |
|---|---|---|
$ | objectחובה באובייקט האב | — |
draft | objectחובה באובייקט האב | — |
draft.id | stringחובה באובייקט האב |
|
draft.workspace_id | stringחובה באובייקט האב |
|
draft.revision | integerחובה באובייקט האב |
|
draft.state | stringחובה באובייקט האב |
|
draft.content | objectחובה באובייקט האב | — |
draft.content.schemaVersion | numberחובה באובייקט האב |
|
draft.content.accountIds | arrayחובה באובייקט האב |
|
draft.content.accountIds[] | stringרשות / פריט |
|
draft.content.caption | stringחובה באובייקט האב |
|
draft.content.hashtags | stringחובה באובייקט האב |
|
draft.content.assetIds | arrayחובה באובייקט האב |
|
draft.content.assetIds[] | stringרשות / פריט |
|
draft.content.threadsTextOnly | booleanחובה באובייקט האב |
|
draft.content.instagramMode | stringחובה באובייקט האב |
|
draft.content.youtubeTitle | stringחובה באובייקט האב |
|
draft.content.youtubePrivacy | stringחובה באובייקט האב |
|
draft.content.youtubeSynthetic | booleanחובה באובייקט האב |
|
draft.content.youtubeCategoryId | stringחובה באובייקט האב |
|
draft.content.youtubeShort | booleanחובה באובייקט האב |
|
draft.content.linkUrl | stringחובה באובייקט האב |
|
draft.content.scheduledAt | stringחובה באובייקט האב |
|
draft.content.displayTimezone | stringחובה באובייקט האב |
|
draft.content.publishNow | booleanחובה באובייקט האב |
|
draft.content.destinationOverrides | objectחובה באובייקט האב |
|
draft.content.destinationOverrides.* | objectרשות / פריט | — |
draft.content.destinationOverrides.*.caption | stringרשות / פריט |
|
draft.content.destinationOverrides.*.scheduledAt | stringרשות / פריט |
|
draft.content.expiresAt | stringחובה באובייקט האב |
|
draft.created_by | string | nullחובה באובייקט האב | — |
draft.created_byanyOf 1 | stringחובה באובייקט האב |
|
draft.created_byanyOf 2 | nullחובה באובייקט האב | — |
draft.updated_by | string | nullחובה באובייקט האב | — |
draft.updated_byanyOf 1 | stringחובה באובייקט האב |
|
draft.updated_byanyOf 2 | nullחובה באובייקט האב | — |
draft.created_at | stringחובה באובייקט האב |
|
draft.updated_at | stringחובה באובייקט האב |
|
draft.submission | object | nullחובה באובייקט האב | — |
draft.submissionanyOf 1 | objectחובה באובייקט האב | — |
draft.submission.idanyOf 1 | stringחובה באובייקט האב |
|
draft.submission.expected_revisionanyOf 1 | integerחובה באובייקט האב |
|
draft.submission.started_atanyOf 1 | stringחובה באובייקט האב |
|
draft.submission.receiptanyOf 1 | object | nullחובה באובייקט האב | — |
draft.submission.receiptanyOf 1 / anyOf 1 | objectחובה באובייקט האב | — |
draft.submission.receipt.batch_idanyOf 1 / anyOf 1 | string | nullחובה באובייקט האב | — |
draft.submission.receipt.batch_idanyOf 1 / anyOf 1 / anyOf 1 | stringחובה באובייקט האב |
|
draft.submission.receipt.batch_idanyOf 1 / anyOf 1 / anyOf 2 | nullחובה באובייקט האב | — |
draft.submission.receipt.successesanyOf 1 / anyOf 1 | arrayחובה באובייקט האב |
|
draft.submission.receipt.successes[]anyOf 1 / anyOf 1 | objectרשות / פריט | — |
draft.submission.receipt.successes[].social_account_idanyOf 1 / anyOf 1 | stringחובה באובייקט האב |
|
draft.submission.receipt.successes[].post_idanyOf 1 / anyOf 1 | stringחובה באובייקט האב |
|
draft.submission.receipt.failuresanyOf 1 / anyOf 1 | arrayחובה באובייקט האב |
|
draft.submission.receipt.failures[]anyOf 1 / anyOf 1 | objectרשות / פריט | — |
draft.submission.receipt.failures[].social_account_idanyOf 1 / anyOf 1 | stringחובה באובייקט האב |
|
draft.submission.receipt.failures[].codeanyOf 1 / anyOf 1 | stringחובה באובייקט האב |
|
draft.submission.receipt.failures[].messageanyOf 1 / anyOf 1 | stringחובה באובייקט האב |
|
draft.submission.receiptanyOf 1 / anyOf 2 | nullחובה באובייקט האב | — |
draft.submissionanyOf 2 | nullחובה באובייקט האב | — |
replayed | booleanחובה באובייקט האב | — |
JSON Schema מלא
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"draft": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"workspace_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"revision": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"state": {
"type": "string",
"enum": [
"draft",
"submitting",
"submitted"
]
},
"content": {
"type": "object",
"properties": {
"schemaVersion": {
"default": 1,
"type": "number",
"const": 1
},
"accountIds": {
"default": [],
"maxItems": 50,
"type": "array",
"items": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
},
"caption": {
"default": "",
"type": "string",
"maxLength": 5000
},
"hashtags": {
"default": "",
"type": "string",
"maxLength": 5000
},
"assetIds": {
"default": [],
"maxItems": 20,
"type": "array",
"items": {
"type": "string",
"maxLength": 16,
"pattern": "^[1-9][0-9]*$"
}
},
"threadsTextOnly": {
"default": false,
"type": "boolean"
},
"instagramMode": {
"default": "REELS",
"type": "string",
"enum": [
"IMAGE",
"REELS",
"CAROUSEL",
"STORY_IMAGE",
"STORY_VIDEO"
]
},
"youtubeTitle": {
"default": "",
"type": "string",
"maxLength": 100
},
"youtubePrivacy": {
"default": "private",
"type": "string",
"enum": [
"private",
"unlisted",
"public"
]
},
"youtubeSynthetic": {
"default": false,
"type": "boolean"
},
"youtubeCategoryId": {
"default": "",
"type": "string",
"maxLength": 32
},
"youtubeShort": {
"default": false,
"type": "boolean"
},
"linkUrl": {
"default": "",
"type": "string",
"maxLength": 2048
},
"scheduledAt": {
"default": "",
"type": "string",
"maxLength": 64
},
"displayTimezone": {
"default": "UTC",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"publishNow": {
"default": false,
"type": "boolean"
},
"destinationOverrides": {
"default": {},
"type": "object",
"propertyNames": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"additionalProperties": {
"type": "object",
"properties": {
"caption": {
"type": "string",
"maxLength": 5000
},
"scheduledAt": {
"type": "string",
"maxLength": 64
}
}
}
},
"expiresAt": {
"default": "",
"type": "string",
"maxLength": 64
}
},
"required": [
"schemaVersion",
"accountIds",
"caption",
"hashtags",
"assetIds",
"threadsTextOnly",
"instagramMode",
"youtubeTitle",
"youtubePrivacy",
"youtubeSynthetic",
"youtubeCategoryId",
"youtubeShort",
"linkUrl",
"scheduledAt",
"displayTimezone",
"publishNow",
"destinationOverrides",
"expiresAt"
]
},
"created_by": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
},
"updated_by": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
},
"created_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"updated_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"submission": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"expected_revision": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"started_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"receipt": {
"anyOf": [
{
"type": "object",
"properties": {
"batch_id": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
},
"successes": {
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"social_account_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"post_id": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
}
},
"required": [
"social_account_id",
"post_id"
]
}
},
"failures": {
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"social_account_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"code": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"message": {
"type": "string",
"maxLength": 2000
}
},
"required": [
"social_account_id",
"code",
"message"
]
}
}
},
"required": [
"batch_id",
"successes",
"failures"
]
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"expected_revision",
"started_at",
"receipt"
]
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"workspace_id",
"revision",
"state",
"content",
"created_by",
"updated_by",
"created_at",
"updated_at",
"submission"
]
},
"replayed": {
"type": "boolean"
}
},
"required": [
"draft",
"replayed"
]
}שגיאות וניסיונות חוזרים בטוחים
בדקו את סטטוס ה-HTTP ואת גוף התגובה. שגיאת אימות 400 עשויה להכיל ZodError; שגיאות מטפל משתמשות בשדות error, message ו-code. שמרו request_id או x-request-id לאבחון, ללא אמצעי גישה. תקנו שגיאות גישה 401/403 לפני ניסיון חוזר, ופעלו לפי Retry-After עבור 429. אם תוצאת כתיבה אינה ודאית או שמוחזר 5xx, קראו תחילה את התוצאה הקיימת. השתמשו שוב במפתח אידמפוטנטיות רק במקומות הנתמכים; התנהגות הניסיון החוזר משתנה בין פעולות ואינה מבטיחה מסירה בדיוק פעם אחת.
מדריך לפתרון בעיותדוגמאות
הדוגמאות משתמשות בערכים בדויים שנבדקו מול הסכמות. החליפו את המזהים בכאלה שאתם מורשים להשתמש בהם, את המדיה בנכסים מוכנים ואת התאריכים במועד הפרסום שאישרתם. בדקו את התאמת החשבון לפני שליחת כתיבה. העמוד הזה אינו שולח בקשות API.
הגדירו בשרת שלכם SOSOAPI_ACCESS_TOKEN לאמצעי גישה שהפעולה הזו מקבלת, והשאירו אותו מחוץ לקוד הדפדפן. עבור סוכן, השתמשו ב-sosoapi auth login כדי להיכנס דרך הדפדפן ולאפשר ל-CLI לרענן את אמצעי הגישה שלו.
request.json
{
"workspace_id": "11111111-1111-4111-8111-111111111111",
"id": "44444444-4444-4444-8444-444444444444",
"mutation_id": "55555555-5555-4555-8555-555555555555",
"content": {
"schemaVersion": 1,
"accountIds": [],
"caption": "An unfinished announcement for team review.",
"hashtags": "",
"assetIds": [],
"threadsTextOnly": false,
"instagramMode": "REELS",
"youtubeTitle": "",
"youtubePrivacy": "private",
"youtubeSynthetic": false,
"youtubeCategoryId": "",
"youtubeShort": false,
"linkUrl": "",
"scheduledAt": "",
"displayTimezone": "UTC",
"publishNow": false,
"destinationOverrides": {},
"expiresAt": ""
}
}cURL
curl --request POST \
"https://gqeshlawtcexsapabaui.supabase.co/functions/v1/studio-api/content-drafts/create" \
-H "Authorization: Bearer $SOSOAPI_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @request.jsonJavaScript
// Server-side JavaScript. Do not print tokens or credential-bearing responses.
const token = process.env.SOSOAPI_ACCESS_TOKEN;
if (!token) throw new Error("Set an accepted credential for this operation");
const response = await fetch("https://gqeshlawtcexsapabaui.supabase.co/functions/v1/studio-api/content-drafts/create", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
body: JSON.stringify({
"workspace_id": "11111111-1111-4111-8111-111111111111",
"id": "44444444-4444-4444-8444-444444444444",
"mutation_id": "55555555-5555-4555-8555-555555555555",
"content": {
"schemaVersion": 1,
"accountIds": [],
"caption": "An unfinished announcement for team review.",
"hashtags": "",
"assetIds": [],
"threadsTextOnly": false,
"instagramMode": "REELS",
"youtubeTitle": "",
"youtubePrivacy": "private",
"youtubeSynthetic": false,
"youtubeCategoryId": "",
"youtubeShort": false,
"linkUrl": "",
"scheduledAt": "",
"displayTimezone": "UTC",
"publishNow": false,
"destinationOverrides": {},
"expiresAt": ""
}
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.CLI
npx sosoapi api post /studio-api/content-drafts/create < request.jsonדוגמת תגובה סינתטית
{
"draft": {
"id": "44444444-4444-4444-8444-444444444444",
"workspace_id": "11111111-1111-4111-8111-111111111111",
"revision": 1,
"state": "draft",
"content": {
"schemaVersion": 1,
"accountIds": [],
"caption": "An unfinished announcement for team review.",
"hashtags": "",
"assetIds": [],
"threadsTextOnly": false,
"instagramMode": "REELS",
"youtubeTitle": "",
"youtubePrivacy": "private",
"youtubeSynthetic": false,
"youtubeCategoryId": "",
"youtubeShort": false,
"linkUrl": "",
"scheduledAt": "",
"displayTimezone": "UTC",
"publishNow": false,
"destinationOverrides": {},
"expiresAt": ""
},
"created_by": null,
"updated_by": null,
"created_at": "2099-01-15T08:00:00Z",
"updated_at": "2099-01-15T08:30:00Z",
"submission": null
},
"replayed": false
}