POST/api/v4/posts

Crea un post per un evento

Crea un post social EVENT con un titolo e un intervallo temporale di inizio e fine, pubblicato sui siti scelti per una o più sedi.

Richiede una chiave API. Consulta Autenticazione per il formato dell’header e la rotazione delle chiavi.

Parametri

Corpo

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

Richiesta di esempio

Corpo pronto da incollare. Sostituisci gli ID e i valori segnaposto con i tuoi.

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

Risposte

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.

Crea un post per un evento: un annuncio con date definite, un title e un intervallo temporale di inizio e fine, visualizzato come scheda evento su Google. La programmazione dell'evento è in postContextInfo (title, startDay, startTime, endDay, endTime); il campo facoltativo postScheduledDates controlla quando il post stesso viene pubblicato e ritirato, un intervallo che solitamente coincide con il periodo che precede l'evento.

Caso d'uso: promuovere un evento in negozio. Annuncia un "Inizio dei saldi estivi" per Jenny Home, con l'intervallo dell'evento fissato al 15 luglio e una CTA LEARN_MORE che rimanda alla pagina dell'evento. Imposta postType: "EVENT" e compila postContextInfo.title; Google rifiuta gli eventi senza titolo. La chiamata restituisce status: INPROGRESS; verifica con GET /posts/{postId} che raggiunga SUCCESS.

Note.

  • Il corpo della richiesta deve essere racchiuso in un oggetto input: ogni campo è una proprietà di input. Un corpo piatto, non racchiuso nell'oggetto, viene rifiutato con uno stato HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided).
  • postContextInfo contiene le date dell'evento; postScheduledDates contiene le date di pubblicazione. Usa postScheduledDates.startDatetime/endDatetime per programmare il post in anticipo e farlo scadere automaticamente dopo l'evento.
  • Fornisci una voce postMessage per ogni sito in postSites.
  • Per un semplice messaggio senza date usa annunci; per coupon/sconti usa offerte.

Operazione di scrittura: non eseguita sull'account reale. La richiesta e la risposta mostrate sono costruite a partire dallo schema dell'API; quando viene eseguita, questa operazione pubblica su profili Google/Facebook reali.

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