POST/api/v4/posts

Crea un post di annuncio

Crea un post social di tipo ANNOUNCEMENT e lo pubblica 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 `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringsobbligatorioSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postMessagearray of objectsfacoltativoPer-site body text: `{ site, message }`. Provide one entry per site in `postSites`.
input.postCtaarray of objectsfacoltativoOptional call-to-action button 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": "Grand Opening Announcement",    "locationIds": ["TG9jYXRpb246MTgwMDI4OQ=="],    "postType": "ANNOUNCEMENT",    "postSites": ["GOOGLE"],    "postMessage": [      { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." }    ],    "postCta": [      { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/opening" }    ],    "postMediaUrl": [      { "site": "GOOGLE", "url": "https://cdn.example.com/opening.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": "U29jaWFsUG9zdDo0NDEyMg==",        "name": "Grand Opening Announcement",        "status": "INPROGRESS",        "type": "ANNOUNCEMENT",        "createdAt": "2026-06-28",        "sites": ["GOOGLE"],        "message": [          { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." }        ],        "cta": [          { "type": { "value": "LEARN_MORE", "label": "Learn more" }, "url": "https://jennyhome.example/opening", "site": "GOOGLE", "tinyUrl": null }        ],        "contextInfo": null,        "mediaUrl": [          { "url": "https://cdn.example.com/opening.jpg", "site": "GOOGLE", "type": "IMAGE" }        ],        "publishDetails": [          { "site": "GOOGLE", "status": "PUBLISHING", "createdDate": "2026-06-28", "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 annuncio: il tipo di post più semplice. Un annuncio contiene un semplice messaggio (con CTA e immagine facoltative), senza date di eventi né dettagli di offerte. Passa postType: "ANNOUNCEMENT" e una voce postMessage per ogni sito in postSites.

Caso d'uso: "Siamo aperti" per tutti i tuoi punti vendita. Annuncia un'inaugurazione o nuovi orari su Google (e Facebook) per un insieme di sedi con una sola chiamata. Fornisci una CTA LEARN_MORE che rimandi al tuo sito e un'immagine per arricchire la scheda. La chiamata restituisce immediatamente status: INPROGRESS; interroga periodicamente GET /posts/{postId} con il valore socialPost.id restituito finché questo non assume il valore SUCCESS e leggi publishDetails[].submissionError se la pubblicazione su un sito non riesce.

Note.

  • Il corpo della richiesta deve essere racchiuso in un oggetto input: ogni campo (postName, locationIds, postType, postSites, …) è 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).
  • postSites e ogni postMessage.site usano l'enumerazione dei siti (GOOGLE, FACEBOOK); fornisci una voce di messaggio per ogni sito su cui vuoi pubblicare.
  • Per pubblicare lo stesso annuncio su molte sedi, passa qui tutti gli ID in locationIds oppure usa POST /bulk-posts per pubblicazioni su larga scala che coinvolgono più sedi.
  • Per i post con date usa eventi; per coupon e 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": "Grand Opening Announcement",      "locationIds": [        "TG9jYXRpb246MTgwMDI4OQ=="      ],      "postType": "ANNOUNCEMENT",      "postSites": [        "GOOGLE"      ],      "postMessage": [        {          "site": "GOOGLE",          "message": "We are now open! Visit Jenny Home this week for our grand opening."        }      ],      "postCta": [        {          "site": "GOOGLE",          "type": "LEARN_MORE",          "url": "https://jennyhome.example/opening"        }      ],      "postMediaUrl": [        {          "site": "GOOGLE",          "url": "https://cdn.example.com/opening.jpg",          "type": "IMAGE"        }      ]    }  }'