/api/v4/postsEinen Angebotspost erstellen
Erstellt einen OFFER-Social-Post mit Gutschein, Rabatt und Bedingungen und veröffentlicht ihn auf gewählten Plattformen für einen oder mehrere Standorte.
Parameter
Body
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
| input | object | erforderlich | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | erforderlich | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | erforderlich | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | erforderlich | Must be `OFFER`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | erforderlich | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postContextInfo | object | optional | Offer details: `{ title, couponCode, discount, redeemUrl, termsConditions, startDay, endDay }`. `title` labels the offer; `startDay`/`endDay` bound its validity. |
| input.postMessage | array of objects | optional | Per-site body text: `{ site, message }`. One entry per site in `postSites`. |
| input.postScheduledDates | object | optional | When to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the offer validity in `postContextInfo`. |
| input.postCta | array of objects | optional | 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.postMediaUrl | array of objects | optional | Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO. |
| input.clientMutationId | string | optional | Optional client token returned unchanged in the response for correlation. |
Beispielanfrage
Body zum direkten Einfügen. Ersetzen Sie Platzhalter-IDs und -Werte durch Ihre eigenen.
{ "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" } ] }}Antworten
200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
{ "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.
Erstellt einen Angebotspost: eine Aktionskarte mit einem Gutscheincode, einem Rabatt, einem Link zum Einlösen und Bedingungen. Die Angebotsdetails stehen in postContextInfo (title, couponCode, discount, redeemUrl, termsConditions, startDay, endDay). Angebote lassen sich gut mit einer CTA vom Typ GET_OFFER kombinieren.
Anwendungsfall: eine zeitlich begrenzte Werbeaktion durchführen. Starten Sie für Jenny Home ein Angebot „25% Rabatt zu Diwali“, das vom 22. Juni bis zum 6. Juli gültig ist, mit dem Gutschein DIWALI25 und einer URL zum Einlösen. Legen Sie postType: "OFFER" fest, füllen Sie postContextInfo aus und fügen Sie eine CTA vom Typ GET_OFFER hinzu. Der Aufruf gibt status: INPROGRESS zurück; überprüfen Sie mit GET /posts/{postId}, ob der Post auf jeder Plattform erscheint, und löschen Sie ihn mit DELETE /posts/{postId} vorzeitig, falls die Werbeaktion endet.
Hinweise.
- Der Request-Body muss in ein
input-Objekt eingebettet sein: Jedes Feld ist eine Eigenschaft voninput. Ein flacher, nicht eingebetteter Body wird mit HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided) abgelehnt. postContextInfo.startDay/endDaybegrenzen die Gültigkeitsdauer des Angebots; verwenden SiepostScheduledDates, wenn Sie zusätzlich unabhängig davon planen möchten, wann der Post veröffentlicht wird bzw. abläuft.- Geben Sie für jede Plattform in
postSiteseinenpostMessage-Eintrag an. - Verwenden Sie für einfache Neuigkeiten Ankündigungen; verwenden Sie für Geschehnisse mit festem Datum Veranstaltungen.
Schreiboperation: nicht im Live-Konto ausgeführt. Die gezeigte Anfrage und Antwort wurden anhand des API-Schemas erstellt; bei der Ausführung wird der Post auf echten Google-/Facebook-Profilen veröffentlicht.
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" } ] } }'