/api/v4/postsCrear una publicación de evento
Crea una publicación social de tipo EVENT con un título y un período de inicio y fin, que se publica en los sitios elegidos para una o más ubicaciones.
Parámetros
Cuerpo
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| input | object | obligatorio | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | obligatorio | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | obligatorio | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | obligatorio | Must be `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | obligatorio | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postContextInfo | object | opcional | Event 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.postMessage | array of objects | opcional | Per-site body text: `{ site, message }`. One entry per site in `postSites`. |
| input.postScheduledDates | object | opcional | When to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`. |
| input.postCta | array of objects | opcional | Optional call-to-action per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER. |
| input.postMediaUrl | array of objects | opcional | Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO. |
| input.clientMutationId | string | opcional | Optional client token returned unchanged in the response for correlation. |
Solicitud de ejemplo
Cuerpo listo para pegar. Sustituye los ID y valores de ejemplo por los tuyos.
{ "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" } ] }}Respuestas
200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
{ "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 una publicación de evento: un anuncio con fecha, un title y un período de inicio y fin que se muestra como una tarjeta de evento en Google. La programación del propio evento está en postContextInfo (title, startDay, startTime, endDay, endTime); el campo opcional postScheduledDates controla cuándo se publica y se retira la propia publicación, cuyo período de publicación suele ser el previo al evento.
Caso de uso: promocionar un evento en la tienda. Anuncia un "Inicio de las rebajas de verano" para Jenny Home con el período del evento el 15 de julio y una llamada a la acción LEARN_MORE que dirija a la página del evento. Establece postType: "EVENT" y completa postContextInfo.title; Google rechaza los eventos sin título. La llamada devuelve status: INPROGRESS; confirma con GET /posts/{postId} que alcanza SUCCESS.
Notas.
- El cuerpo de la solicitud debe estar contenido en un objeto
input: cada campo es una propiedad deinput. Un cuerpo plano, sin este objeto contenedor, se rechaza con un código HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided). postContextInfocontiene las fechas del evento;postScheduledDatescontiene las fechas de publicación. UsapostScheduledDates.startDatetime/endDatetimepara programar la publicación con antelación y hacer que caduque automáticamente después del evento.- Proporciona una entrada
postMessagepara cada sitio depostSites. - Para un mensaje sencillo sin fechas, usa anuncios; para cupones o descuentos, usa ofertas.
Operación de escritura: no se ha ejecutado en la cuenta real. La solicitud y la respuesta que se muestran se han construido a partir del esquema de la API; al ejecutarse, esta operación publica en perfiles reales de Google/Facebook.
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" } ] } }'