/api/v4/postsCréer une publication d’annonce
Crée une publication sociale de type ANNOUNCEMENT et la publie sur les sites choisis pour un ou plusieurs établissements.
Paramètres
Corps
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
| input | object | obligatoire | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | obligatoire | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | obligatoire | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | obligatoire | Must be `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | obligatoire | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postMessage | array of objects | facultatif | Per-site body text: `{ site, message }`. Provide one entry per site in `postSites`. |
| input.postCta | array of objects | facultatif | 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 | facultatif | Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO. |
| input.clientMutationId | string | facultatif | Optional client token returned unchanged in the response for correlation. |
Exemple de requête
Corps prêt à coller. Remplacez les identifiants et valeurs d’exemple par les vôtres.
{ "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" } ] }}Réponses
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.
Crée une annonce : le type de publication le plus simple. Une annonce contient un message simple (avec un CTA et une image facultatifs), sans dates d’événement ni détails d’offre. Passez postType: "ANNOUNCEMENT" et une entrée postMessage par site dans postSites.
Cas d’utilisation : « Nous sommes ouverts » pour l’ensemble de vos points de vente. Annoncez une inauguration ou de nouveaux horaires sur Google (et Facebook) pour un ensemble d’établissements en un seul appel. Fournissez un CTA LEARN_MORE pointant vers votre site et une image pour enrichir la carte. L’appel renvoie immédiatement status: INPROGRESS ; interrogez régulièrement GET /posts/{postId} avec la valeur socialPost.id renvoyée jusqu’à ce que le statut soit SUCCESS, et consultez publishDetails[].submissionError en cas d’échec pour un site.
Remarques.
- Le corps de la requête doit être encapsulé dans un objet
input: chaque champ (postName,locationIds,postType,postSites, …) est une propriété deinput. Un corps plat, non encapsulé, est rejeté avec un statut HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided). postSiteset chaquepostMessage.siteutilisent l’énumération des sites (GOOGLE,FACEBOOK) ; fournissez une entrée de message pour chaque site ciblé.- Pour publier la même annonce dans de nombreux établissements, passez tous les identifiants dans
locationIdsici, ou utilisezPOST /bulk-postspour les déploiements à grande échelle sur plusieurs établissements. - Pour les publications datées, utilisez les événements ; pour les coupons ou les réductions, utilisez les offres.
Opération d’écriture : non exécutée sur le compte réel. La requête et la réponse présentées sont construites à partir du schéma de l’API ; l’exécution de cette opération publie sur de vrais profils Google/Facebook.
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" } ] } }'