POST/api/v4/posts

Cré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.

Nécessite une clé API. Consultez Authentification pour le format de l’en-tête et la rotation des clés.

Paramètres

Corps

NomTypeObligatoireDescription
inputobjectobligatoireWrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.postNamestringobligatoireInternal name for the campaign (not shown to customers).
input.locationIdsarray of stringsobligatoireBase64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`).
input.postTypestringobligatoireMust be `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringsobligatoireSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postMessagearray of objectsfacultatifPer-site body text: `{ site, message }`. Provide one entry per site in `postSites`.
input.postCtaarray of objectsfacultatifOptional 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 objectsfacultatifOptional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO.
input.clientMutationIdstringfacultatifOptional 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.

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

Réponses

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.

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é de input. Un corps plat, non encapsulé, est rejeté avec un statut HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided).
  • postSites et chaque postMessage.site utilisent 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 locationIds ici, ou utilisez POST /bulk-posts pour 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.

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