POST
/api/v4/postsイベント投稿を作成する
タイトルと開始・終了日時を持つ EVENT ソーシャル投稿を作成し、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 `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | 必須 | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postContextInfo | object | 任意 | Event details: `{ title, startDay, startTime, endDay, endTime }`. `title` is required by Google for events; `startDay`/`endDay` are dates, `startTime`/`endTime` are display strings like `10:00am`. |
| input.postMessage | array of objects | 任意 | Per-site body text: `{ site, message }`. One entry per site in `postSites`. |
| input.postScheduledDates | object | 任意 | When to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`. |
| input.postCta | array of objects | 任意 | Optional call-to-action 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": "Summer Sale Kickoff Event", "locationIds": ["TG9jYXRpb246MTgwMDI4OQ=="], "postType": "EVENT", "postSites": ["GOOGLE"], "postContextInfo": { "title": "Summer Sale Kickoff", "startDay": "2026-07-15", "startTime": "10:00am", "endDay": "2026-07-15", "endTime": "06:00pm" }, "postMessage": [ { "site": "GOOGLE", "message": "Join us for the Summer Sale kickoff, refreshments, giveaways, and up to 40% off in store." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/summer-event" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/summer-event.jpg", "type": "IMAGE" } ] }}レスポンス
200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
{ "data": { "createSocialPost": { "clientMutationId": null, "success": true, "errors": [], "socialPost": { "id": "U29jaWFsUG9zdDo0NDEyMw==", "name": "Summer Sale Kickoff Event", "status": "INPROGRESS", "type": "EVENT", "createdAt": "2026-07-01", "scheduledStartDate": "2026-07-15", "scheduledEndDate": "2026-07-15", "sites": ["GOOGLE"], "message": [ { "site": "GOOGLE", "message": "Join us for the Summer Sale kickoff, refreshments, giveaways, and up to 40% off in store." } ], "cta": [ { "type": { "value": "LEARN_MORE", "label": "Learn more" }, "url": "https://jennyhome.example/summer-event", "site": "GOOGLE", "tinyUrl": null } ], "contextInfo": { "title": "Summer Sale Kickoff", "startDay": "2026-07-15", "startTime": "10:00am", "endDay": "2026-07-15", "endTime": "06:00pm", "couponCode": null, "redeemUrl": null, "termsConditions": null, "discount": null, "locationType": null }, "mediaUrl": [ { "url": "https://cdn.example.com/summer-event.jpg", "site": "GOOGLE", "type": "IMAGE" } ], "publishDetails": [ { "site": "GOOGLE", "status": "PUBLISHING", "createdDate": "2026-07-01", "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.
イベント投稿を作成します。これは、titleと開始・終了日時を持つ日付付きのお知らせで、Google ではイベントカードとして表示されます。イベント自体のスケジュールはpostContextInfo(title、startDay、startTime、endDay、endTime)で指定します。省略可能なpostScheduledDatesは、投稿自体の公開日時と公開終了日時を制御し、通常はイベント開催までの期間を指定します。
ユースケース:店内イベントを宣伝する。 Jenny Home の「サマーセール開始イベント」を、7 月 15 日の開催時間帯とイベントページへのLEARN_MORE CTA を指定して告知します。Google はタイトルのないイベントを拒否するため、postType: "EVENT"を設定し、postContextInfo.titleを入力します。この呼び出しはstatus: INPROGRESSを返します。GET /posts/{postId}で、SUCCESSになったことを確認します。
注記。
- リクエストボディは
inputオブジェクトでラップする必要があります。すべてのフィールドはinputのプロパティです。ラップされていないフラットなボディは HTTP 400(Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided)で拒否されます。 postContextInfoにはイベントの日時を指定し、postScheduledDatesには公開の日時を指定します。postScheduledDates.startDatetime/endDatetimeを使用して投稿を事前に予約し、イベント終了後に自動的に公開を終了します。postSites内の各サイトに対してpostMessageエントリを指定します。- 日付のない通常のメッセージにはお知らせを使用し、クーポンや割引には特典を使用します。
書き込み操作:本番アカウントに対しては実行していません。表示されているリクエストとレスポンスは 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": "Summer Sale Kickoff Event", "locationIds": [ "TG9jYXRpb246MTgwMDI4OQ==" ], "postType": "EVENT", "postSites": [ "GOOGLE" ], "postContextInfo": { "title": "Summer Sale Kickoff", "startDay": "2026-07-15", "startTime": "10:00am", "endDay": "2026-07-15", "endTime": "06:00pm" }, "postMessage": [ { "site": "GOOGLE", "message": "Join us for the Summer Sale kickoff, refreshments, giveaways, and up to 40% off in store." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/summer-event" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/summer-event.jpg", "type": "IMAGE" } ] } }'