POST/api/v4/posts

Criar uma publicação de evento

Cria uma publicação social do tipo EVENT com um título e um período de início e término, publicada nos sites escolhidos para um ou mais locais.

Requer uma chave de API. Consulte Autenticação para ver o formato do cabeçalho e a rotação de chaves.

Parâmetros

Corpo

NomeTipoObrigatórioDescrição
inputobjectobrigatórioWrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.postNamestringobrigatórioInternal name for the campaign (not shown to customers).
input.locationIdsarray of stringsobrigatórioBase64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`).
input.postTypestringobrigatórioMust be `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringsobrigatórioSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postContextInfoobjectopcionalEvent 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.postMessagearray of objectsopcionalPer-site body text: `{ site, message }`. One entry per site in `postSites`.
input.postScheduledDatesobjectopcionalWhen to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`.
input.postCtaarray of objectsopcionalOptional call-to-action per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER.
input.postMediaUrlarray of objectsopcionalOptional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO.
input.clientMutationIdstringopcionalOptional client token returned unchanged in the response for correlation.

Exemplo de requisição

Corpo pronto para colar. Substitua os IDs e valores de exemplo pelos seus.

Request body
{  "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" }    ]  }}

Respostas

200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
Response
{  "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.

Cria uma publicação de evento: um anúncio com data, um title e um período de início e término, exibido como um cartão de evento no Google. A programação do próprio evento fica em postContextInfo (title, startDay, startTime, endDay, endTime); o campo opcional postScheduledDates controla quando a própria publicação é publicada e retirada, período que geralmente antecede o evento.

Caso de uso: promover um evento na loja. Anuncie uma "Abertura da promoção de verão" para a Jenny Home, com o período do evento em 15 de julho e uma chamada para ação LEARN_MORE que leva à página do evento. Defina postType: "EVENT" e preencha postContextInfo.title, pois o Google rejeita eventos sem título. A chamada retorna status: INPROGRESS; confirme com GET /posts/{postId} que a publicação atinge SUCCESS.

Observações.

  • O corpo da requisição deve estar encapsulado em um objeto input: cada campo é uma propriedade de input. Um corpo sem esse encapsulamento é rejeitado com o status HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided).
  • postContextInfo contém as datas do evento; postScheduledDates contém as datas de publicação. Use postScheduledDates.startDatetime/endDatetime para agendar a publicação com antecedência e fazê-la expirar automaticamente após o evento.
  • Forneça uma entrada postMessage para cada site em postSites.
  • Para uma mensagem simples sem datas, use anúncios; para cupons/descontos, use ofertas.

Operação de escrita: não executada na conta real. A requisição e a resposta exibidas são construídas a partir do esquema da API; quando executada, esta operação publica em perfis reais do 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": "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"        }      ]    }  }'