POST
/api/v4/social/brands建立品牌
建立社群品牌,作為擁有已連結社群帳號及其所發布貼文的容器。API 方案的品牌數量不限。
參數
請求主體
| 名稱 | 類型 | 必填 | 說明 |
|---|---|---|---|
| input | object | 必填 | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.profileName | string | 必填 | Display name of the brand. Shown wherever the brand is listed and used as the default author name in the composer. |
| input.timezone | object | 必填 | The brand's timezone as `{ label, tzCode, name, utc }`, all strings. `tzCode` is the one that matters: it is the IANA identifier the API validates and uses to interpret every `scheduleDate` / `scheduleTime` on this brand's posts. The other three are display labels. |
| input.businessIntent | string | 選填 | One or two sentences describing what the business does, used to tailor content suggestions. Defaults to `general` when omitted. |
| input.categories | array of strings | 選填 | Business categories for the brand, e.g. `["Furniture Store"]`. Defaults to an empty list. |
| input.siteUrl | string | 選填 | The brand's website. Used to enrich content suggestions; setting it also queues a one-off read of the site. |
| input.logo | string | 選填 | Public https URL of the brand logo. |
| input.countryIso | string | 選填 | Two-letter ISO country code for the brand, e.g. `US`. |
| input.bio | string | 選填 | Short brand bio. |
| input.brandHashtags | array of strings | 選填 | Hashtags that belong to the brand, offered as suggestions in the composer. |
| input.competitorHashtags | array of strings | 選填 | Competitor hashtags to track alongside the brand's own. |
| input.contentPreferredLanguage | string | 選填 | Preferred language for generated content, e.g. `en`. |
請求範例
可直接貼上的請求主體。請將預留位置 ID 與值換成您自己的。
{ "input": { "profileName": "Jenny Home", "timezone": { "label": "(GMT-05:00) Eastern Time", "tzCode": "America/New_York", "name": "Eastern Standard Time", "utc": "-05:00" }, "businessIntent": "A family-run home furnishings store selling handmade furniture and textiles.", "categories": ["Furniture Store", "Home Goods"], "siteUrl": "https://jennyhome.example", "countryIso": "US", "bio": "Handmade furniture for real homes.", "brandHashtags": ["jennyhome", "handmadefurniture"] }}回應
200Brand created. `socialProfile.id` is the `brandId` every other Social endpoint takes.
{ "data": { "createSocialProfile": { "success": true, "error": null, "socialProfile": { "id": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902", "profileName": "Jenny Home", "archived": false, "logo": null, "profileLogo": null, "siteUrl": "https://jennyhome.example", "countryIso": "US", "bio": "Handmade furniture for real homes.", "businessIntent": "A family-run home furnishings store selling handmade furniture and textiles.", "categories": ["Furniture Store", "Home Goods"], "brandHashtags": ["jennyhome", "handmadefurniture"], "competitorHashtags": [], "connectedChannelCount": 0, "timezone": { "label": "(GMT-05:00) Eastern Time", "tzCode": "America/New_York", "name": "Eastern Standard Time", "utc": "-05:00" }, "contentPreferredLanguage": "en" } } }}200Validation failed. The status is still 200: read `success`.
{ "data": { "createSocialProfile": { "success": false, "error": { "message": "SY90003: timezone.tzCode is not a valid IANA identifier", "code": "SY90003", "contextInfo": null }, "socialProfile": null } }}401Unauthenticated, missing or invalid API key.
建立品牌:Social API 中的頂層物件。品牌擁有您連結至該品牌的社群帳號,以及透過這些帳號發布的每一則貼文。在至少建立 1 個品牌之前,無法呼叫 Social API 中的其他功能,因此這是任何 Social 整合的第一個請求。
使用案例:協助客戶開始使用社群發布功能。當客戶在您的產品中註冊時,請為他們想要發布內容的每個商家各建立 1 個品牌。將傳回的 socialProfile.id 儲存至您自己的該商家紀錄中:它是 POST /social/brands/{brandId}/connections/link 和 GET /social/brands/{brandId}/posts 中的 brandId 路徑佔位符,也是您建立每則貼文時的 socialProfileId 主體欄位。接著,針對使用者想要發布內容的每個平台,引導他們透過託管的連線連結完成連結。
注意事項。
- 請求主體必須包在
input物件中。Social API 中的每項寫入操作都採用這種包裝方式,只有一個例外:連線連結接受扁平結構的主體。 - 檢查
success,而非 HTTP 狀態。驗證失敗時,例如缺少profileName或timezone.tzCode不明,會傳回HTTP 200,並附帶success: false,原因則包含在error中。只有當success為true時,才將此次呼叫視為成功。 - 只有
profileName和timezone為必填。businessIntent和categories分別預設為general和空清單,因此,如果整合中沒有對應欄位,可以完全省略這些欄位。 timezone.tzCode並非裝飾。使用scheduleDate+scheduleTime排程的貼文,會依品牌的時區解讀,而非呼叫者的時區,也不是 UTC。日後變更此設定,不會調整已排程貼文的時間。- 品牌一律屬於 API 金鑰所對應的帳戶。無法在其他帳戶中建立品牌:主體中的任何帳戶識別碼都會被忽略。
- 品牌 ID 是一般 UUID。它們並非 Locations 和地點 Posts 所使用的 Base64 relay ID,因此請勿將其編碼或解碼。同一個 ID 會作為
brandId路徑佔位符及socialProfileId主體欄位出現:brandId只會是 URL 佔位符,絕不會是主體欄位。 - API 方案沒有品牌數量上限。品牌數量不限,也不計入用量,因此這項呼叫絕不會因為達到上限而遭拒,您也不需要在建立品牌前檢查剩餘額度。計入用量的是連線,也就是將某個社群網路上的 1 個社群帳號連結至 1 個品牌。請參閱方案與加購項目,瞭解連線級距與連線套組的價格,並在引導使用者透過連線連結完成連結之前,透過
GET /social/limits讀取您的剩餘連線額度。
寫入操作:未在正式帳戶上執行。此處顯示的請求與回應是根據 API 結構描述建構的。
Request
curl -X POST 'https://listingsapi.com/api/v4/social/brands' \ -H "Authorization: API $LISTINGSAPI_KEY" \ -H 'Content-Type: application/json' \ -d '{ "input": { "profileName": "Jenny Home", "timezone": { "label": "(GMT-05:00) Eastern Time", "tzCode": "America/New_York", "name": "Eastern Standard Time", "utc": "-05:00" }, "businessIntent": "A family-run home furnishings store selling handmade furniture and textiles.", "categories": [ "Furniture Store", "Home Goods" ], "siteUrl": "https://jennyhome.example", "countryIso": "US", "bio": "Handmade furniture for real homes.", "brandHashtags": [ "jennyhome", "handmadefurniture" ] } }'