POST/api/v4/posts

Einen 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.

Erfordert einen API-Schlüssel. Format des Headers und Schlüsselrotation finden Sie unter Authentifizierung.

Parameter

Body

NameTypErforderlichBeschreibung
inputobjecterforderlichWrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.postNamestringerforderlichInternal name for the campaign (not shown to customers).
input.locationIdsarray of stringserforderlichBase64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`).
input.postTypestringerforderlichMust be `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringserforderlichSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postContextInfoobjectoptionalEvent 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.postMessagearray of objectsoptionalPer-site body text: `{ site, message }`. One entry per site in `postSites`.
input.postScheduledDatesobjectoptionalWhen to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`.
input.postCtaarray of objectsoptionalOptional call-to-action per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER.
input.postMediaUrlarray of objectsoptionalOptional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO.
input.clientMutationIdstringoptionalOptional client token returned unchanged in the response for correlation.

Beispielanfrage

Body zum direkten Einfügen. Ersetzen Sie Platzhalter-IDs und -Werte durch Ihre eigenen.

Request body
{  "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.
Response
{  "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 von input. Ein flacher, nicht eingebetteter Body wird mit HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided) abgelehnt.
  • postContextInfo enthält die Veranstaltungsdaten; postScheduledDates enthält die Veröffentlichungsdaten. Verwenden Sie postScheduledDates.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 postSites einen postMessage-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.

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"        }      ]    }  }'