/api/v4/postsCrea un post di annuncio
Crea un post social di tipo ANNOUNCEMENT e lo pubblica sui siti scelti per una o più sedi.
Parametri
Corpo
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
| input | object | obbligatorio | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | obbligatorio | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | obbligatorio | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | obbligatorio | Must be `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | obbligatorio | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postMessage | array of objects | facoltativo | Per-site body text: `{ site, message }`. Provide one entry per site in `postSites`. |
| input.postCta | array of objects | facoltativo | Optional call-to-action button per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER. |
| input.postMediaUrl | array of objects | facoltativo | Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO. |
| input.clientMutationId | string | facoltativo | Optional 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.
{ "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.
{ "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à diinput. Un corpo piatto, non racchiuso nell'oggetto, viene rifiutato con uno stato HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided). postSitese ognipostMessage.siteusano 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
locationIdsoppure usaPOST /bulk-postsper 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.
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" } ] } }'