POST/api/v4/posts

特典投稿を作成する

クーポン、割引、利用条件を含む OFFER ソーシャル投稿を作成し、1 つ以上の拠点について選択したサイトに公開します。

API キーが必要です。ヘッダーの形式とキーのローテーションについては認証を参照してください。

パラメーター

ボディ

名前型必須説明
inputobject必須Wrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.postNamestring必須Internal name for the campaign (not shown to customers).
input.locationIdsarray of strings必須Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`).
input.postTypestring必須Must be `OFFER`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of strings必須Sites to publish to: `GOOGLE`, `FACEBOOK`.
input.postContextInfoobject任意Offer details: `{ title, couponCode, discount, redeemUrl, termsConditions, startDay, endDay }`. `title` labels the offer; `startDay`/`endDay` bound its validity.
input.postMessagearray of objects任意Per-site body text: `{ site, message }`. One entry per site in `postSites`.
input.postScheduledDatesobject任意When to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the offer validity in `postContextInfo`.
input.postCtaarray of objects任意Optional call-to-action per site: `{ site, type, url }`. The `CTAType` enum accepts BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, and GET_OFFER. There is no `REDEEM`. For offer posts, Google takes ORDER and Facebook takes GET_OFFER.
input.postMediaUrlarray of objects任意Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO.
input.clientMutationIdstring任意Optional client token returned unchanged in the response for correlation.

リクエストの例

そのまま貼り付けられるボディです。プレースホルダーの ID と値をご自身のものに置き換えてください。

Request body
{  "input": {    "postName": "Diwali 25% Off",    "locationIds": ["TG9jYXRpb246MTgwMDI4OQ=="],    "postType": "OFFER",    "postSites": ["GOOGLE"],    "postContextInfo": {      "title": "25% off storewide",      "couponCode": "DIWALI25",      "discount": "25%",      "redeemUrl": "https://jennyhome.example/diwali",      "termsConditions": "Valid in-store only through July 6. Cannot be combined with other offers.",      "startDay": "2026-06-22",      "endDay": "2026-07-06"    },    "postMessage": [      { "site": "GOOGLE", "message": "Celebrate with us: 25% off everything in store this festive week." }    ],    "postCta": [      { "site": "GOOGLE", "type": "GET_OFFER", "url": "https://jennyhome.example/diwali" }    ],    "postMediaUrl": [      { "site": "GOOGLE", "url": "https://cdn.example.com/diwali.jpg", "type": "IMAGE" }    ]  }}

レスポンス

200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
Response
{  "data": {    "createSocialPost": {      "clientMutationId": null,      "success": true,      "errors": [],      "socialPost": {        "id": "U29jaWFsUG9zdDo0NDEyNA==",        "name": "Diwali 25% Off",        "status": "INPROGRESS",        "type": "OFFER",        "createdAt": "2026-06-20",        "scheduledStartDate": "2026-06-22",        "scheduledEndDate": "2026-07-06",        "sites": ["GOOGLE"],        "message": [          { "site": "GOOGLE", "message": "Celebrate with us: 25% off everything in store this festive week." }        ],        "cta": [          { "type": { "value": "GET_OFFER", "label": "Get offer" }, "url": "https://jennyhome.example/diwali", "site": "GOOGLE", "tinyUrl": null }        ],        "contextInfo": {          "title": "25% off storewide",          "couponCode": "DIWALI25",          "discount": "25%",          "redeemUrl": "https://jennyhome.example/diwali",          "termsConditions": "Valid in-store only through July 6. Cannot be combined with other offers.",          "startDay": "2026-06-22",          "endDay": "2026-07-06",          "startTime": null,          "endTime": null,          "locationType": null        },        "mediaUrl": [          { "url": "https://cdn.example.com/diwali.jpg", "site": "GOOGLE", "type": "IMAGE" }        ],        "publishDetails": [          { "site": "GOOGLE", "status": "PUBLISHING", "createdDate": "2026-06-20", "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.

特典投稿を作成します。これは、クーポンコード、割引、引き換えリンク、利用条件を含むプロモーションカードです。特典の詳細は postContextInfo(title、couponCode、discount、redeemUrl、termsConditions、startDay、endDay)に指定します。特典は GET_OFFER CTA と組み合わせるのに適しています。

ユースケース:期間限定のプロモーションを実施する。 Jenny Home 向けに、6 月 22 日~7 月 6 日まで有効な「Diwali 25% オフ」特典を、クーポン DIWALI25 と引き換え URL を付けて開始します。postType: "OFFER" を設定し、postContextInfo を入力して、GET_OFFER CTA を追加します。この呼び出しは status: INPROGRESS を返します。GET /posts/{postId} で各サイトへの掲載を確認し、プロモーションが終了した場合は DELETE /posts/{postId} で早期に削除します。

注意事項。

  • リクエストボディは input オブジェクトでラップする必要があります。すべてのフィールドは input のプロパティです。ラップされていないフラットなボディは、HTTP 400(Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided)で拒否されます。
  • postContextInfo.startDay/endDay は特典の有効期間を定めます。投稿の公開日時と有効期限も個別にスケジュールする場合は、postScheduledDates を使用します。
  • 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": "Diwali 25% Off",      "locationIds": [        "TG9jYXRpb246MTgwMDI4OQ=="      ],      "postType": "OFFER",      "postSites": [        "GOOGLE"      ],      "postContextInfo": {        "title": "25% off storewide",        "couponCode": "DIWALI25",        "discount": "25%",        "redeemUrl": "https://jennyhome.example/diwali",        "termsConditions": "Valid in-store only through July 6. Cannot be combined with other offers.",        "startDay": "2026-06-22",        "endDay": "2026-07-06"      },      "postMessage": [        {          "site": "GOOGLE",          "message": "Celebrate with us: 25% off everything in store this festive week."        }      ],      "postCta": [        {          "site": "GOOGLE",          "type": "GET_OFFER",          "url": "https://jennyhome.example/diwali"        }      ],      "postMediaUrl": [        {          "site": "GOOGLE",          "url": "https://cdn.example.com/diwali.jpg",          "type": "IMAGE"        }      ]    }  }'