POST
/api/v4/postsお知らせ投稿を作成
ANNOUNCEMENTソーシャル投稿を作成し、1つ以上の拠点について、選択したサイトに公開します。
パラメーター
ボディ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
| input | object | 必須 | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | 必須 | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | 必須 | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | 必須 | Must be `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | 必須 | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postMessage | array of objects | 任意 | Per-site body text: `{ site, message }`. Provide one entry per site in `postSites`. |
| input.postCta | array of objects | 任意 | Optional call-to-action button per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER. |
| input.postMediaUrl | array of objects | 任意 | Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO. |
| input.clientMutationId | string | 任意 | Optional client token returned unchanged in the response for correlation. |
リクエストの例
そのまま貼り付けられるボディです。プレースホルダーの ID と値をご自身のものに置き換えてください。
{ "input": { "postName": "Grand Opening Announcement", "locationIds": ["TG9jYXRpb246MTgwMDI4OQ=="], "postType": "ANNOUNCEMENT", "postSites": ["GOOGLE"], "postMessage": [ { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/opening" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/opening.jpg", "type": "IMAGE" } ] }}レスポンス
200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
{ "data": { "createSocialPost": { "clientMutationId": null, "success": true, "errors": [], "socialPost": { "id": "U29jaWFsUG9zdDo0NDEyMg==", "name": "Grand Opening Announcement", "status": "INPROGRESS", "type": "ANNOUNCEMENT", "createdAt": "2026-06-28", "sites": ["GOOGLE"], "message": [ { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." } ], "cta": [ { "type": { "value": "LEARN_MORE", "label": "Learn more" }, "url": "https://jennyhome.example/opening", "site": "GOOGLE", "tinyUrl": null } ], "contextInfo": null, "mediaUrl": [ { "url": "https://cdn.example.com/opening.jpg", "site": "GOOGLE", "type": "IMAGE" } ], "publishDetails": [ { "site": "GOOGLE", "status": "PUBLISHING", "createdDate": "2026-06-28", "submissionError": null } ], "postLinks": [], "locationIds": [1800289] } } }}400Bad request, the body was not wrapped in `input` (error message: `Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided`).
401Unauthenticated, missing or invalid API key.
最もシンプルな投稿タイプであるお知らせを作成します。お知らせには、イベントの日付や特典の詳細を含めず、通常のメッセージ(および任意のCTAと画像)を掲載します。postType: "ANNOUNCEMENT"を渡し、postSitesにはサイトごとに1つのpostMessageエントリを指定します。
ユースケース:複数の店舗で「営業開始」を告知する。 1回の呼び出しで、複数の拠点のグランドオープンや新しい営業時間をGoogle(およびFacebook)に告知します。自社サイトにリンクするLEARN_MOREのCTAと画像を指定すると、より充実したカードになります。呼び出しはstatus: INPROGRESSを返してすぐに終了します。返されたsocialPost.idを使ってGET /posts/{postId}をSUCCESSになるまでポーリングし、いずれかのサイトで失敗した場合はpublishDetails[].submissionErrorを確認します。
注意事項。
- リクエストボディは
inputオブジェクトでラップする必要があります。すべてのフィールド(postName、locationIds、postType、postSitesなど)はinputのプロパティです。ラップしていないボディは、HTTP 400(Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided)で拒否されます。 postSitesと各postMessage.siteにはサイトの列挙値(GOOGLE、FACEBOOK)を使用します。対象とするすべてのサイトにメッセージエントリを指定してください。- 同じお知らせを多数の拠点に公開するには、このリクエストの
locationIdsにすべてのIDを渡すか、大規模な複数拠点への展開にはPOST /bulk-postsを使用します。 - 日付を指定する投稿にはイベントを、クーポンや割引には特典を使用します。
書き込み操作:実際のアカウントに対しては実行していません。表示されているリクエストとレスポンスはAPIスキーマから作成したものです。この操作を実行すると、実際のGoogle/Facebookプロフィールに投稿されます。
Request
curl -X POST 'https://listingsapi.com/api/v4/posts' \ -H "Authorization: API $LISTINGSAPI_KEY" \ -H 'Content-Type: application/json' \ -d '{ "input": { "postName": "Grand Opening Announcement", "locationIds": [ "TG9jYXRpb246MTgwMDI4OQ==" ], "postType": "ANNOUNCEMENT", "postSites": [ "GOOGLE" ], "postMessage": [ { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/opening" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/opening.jpg", "type": "IMAGE" } ] } }'