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のすべての書き込みはこの形式でラップしますが、例外が1つあります。接続リンクはラップしていないボディを受け付けます。 - HTTPステータスではなく、
successを確認してください。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つのソーシャルアカウントを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" ] } }'