/api/v4/postsEinen Veranstaltungsbeitrag erstellen
Erstellt und veröffentlicht einen EVENT-Social-Media-Beitrag mit Titel und Start- und Endzeit auf gewählten Websites 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 `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | erforderlich | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postContextInfo | object | optional | 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 | 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 event's own dates in `postContextInfo`. |
| input.postCta | array of objects | optional | 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 | 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": "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" } ] }}Antworten
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.
Erstellt einen Veranstaltungsbeitrag: eine datierte Ankündigung mit einem title sowie einem Start- und Endzeitpunkt, die auf Google als Veranstaltungskarte angezeigt wird. Der Zeitplan der Veranstaltung selbst steht in postContextInfo (title, startDay, startTime, endDay, endTime); das optionale postScheduledDates steuert, wann der Beitrag selbst veröffentlicht und wieder entfernt wird, wobei dieser Zeitraum üblicherweise im Vorfeld der Veranstaltung liegt.
Anwendungsfall: eine Veranstaltung im Geschäft bewerben. Kündigen Sie für Jenny Home einen „Auftakt zum Sommerschlussverkauf“ mit einem Veranstaltungszeitraum am 15. Juli und einem LEARN_MORE-CTA zur Veranstaltungsseite an. Setzen Sie postType: "EVENT" und füllen Sie postContextInfo.title aus; Google lehnt Veranstaltungen ohne Titel ab. Der Aufruf gibt status: INPROGRESS zurück; bestätigen Sie mit GET /posts/{postId}, dass der Beitrag SUCCESS erreicht.
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. postContextInfoenthält die Veranstaltungsdaten;postScheduledDatesenthält die Veröffentlichungsdaten. Verwenden SiepostScheduledDates.startDatetime/endDatetime, um den Beitrag im Voraus zu planen und ihn nach der Veranstaltung automatisch ablaufen zu lassen.- Geben Sie für jede Website in
postSiteseinenpostMessage-Eintrag an. - Verwenden Sie für eine einfache Nachricht ohne Datumsangaben Ankündigungen; verwenden Sie für Gutscheine/Rabatte Angebote.
Schreiboperation: nicht im Live-Konto ausgeführt. Die gezeigte Anfrage und Antwort wurden anhand des API-Schemas erstellt; bei der Ausführung wird damit auf echten Google-/Facebook-Profilen gepostet.
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" } ] } }'