POST/api/v4/posts

Etkinlik gönderisi oluşturun

Bir veya daha fazla konum için seçilen sitelerde yayımlanan, başlığı ve başlangıç/bitiş zaman aralığı olan bir EVENT sosyal medya gönderisi oluşturur.

API anahtarı gerektirir. Başlık biçimi ve anahtar yenileme için Kimlik doğrulama bölümüne bakın.

Parametreler

Gövde

AdTürZorunluAçıklama
inputobjectzorunluWrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.postNamestringzorunluInternal name for the campaign (not shown to customers).
input.locationIdsarray of stringszorunluBase64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`).
input.postTypestringzorunluMust be `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringszorunluSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postContextInfoobjectisteğe bağlı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.postMessagearray of objectsisteğe bağlıPer-site body text: `{ site, message }`. One entry per site in `postSites`.
input.postScheduledDatesobjectisteğe bağlıWhen to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`.
input.postCtaarray of objectsisteğe bağlıOptional call-to-action per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER.
input.postMediaUrlarray of objectsisteğe bağlıOptional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO.
input.clientMutationIdstringisteğe bağlıOptional client token returned unchanged in the response for correlation.

Örnek istek

Yapıştırmaya hazır gövde. Yer tutucu kimlikleri ve değerleri kendi değerlerinizle değiştirin.

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

Yanıtlar

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.

Bir etkinlik gönderisi oluşturur: Google'da etkinlik kartı olarak görüntülenen, title ve başlangıç/bitiş zaman aralığı içeren tarihli bir duyuru. Etkinliğin kendi takvimi postContextInfo (title, startDay, startTime, endDay, endTime) içinde yer alır; isteğe bağlı postScheduledDates ise gönderinin kendisinin ne zaman yayımlanacağını ve yayından kaldırılacağını belirler; bu aralık genellikle etkinliğe kadar olan dönemdir.

Kullanım senaryosu: mağaza içi bir etkinliği tanıtın. Jenny Home için etkinlik zaman aralığı 15 Temmuz'da olacak şekilde bir "Yaz İndirimi Açılışı" duyurun ve etkinlik sayfasına yönlendiren bir LEARN_MORE CTA ekleyin. postType: "EVENT" değerini ayarlayın ve postContextInfo.title alanını doldurun; Google, başlığı olmayan etkinlikleri reddeder. Çağrı status: INPROGRESS döndürür; SUCCESS durumuna ulaştığını GET /posts/{postId} ile doğrulayın.

Notlar.

  • İstek gövdesi bir input nesnesi içine alınmalıdır: her alan, input nesnesinin bir özelliğidir. Bir nesne içine alınmamış düz bir gövde, HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided) ile reddedilir.
  • postContextInfo, etkinlik tarihlerini; postScheduledDates ise yayımlama tarihlerini içerir. Gönderiyi önceden planlamak ve etkinlikten sonra otomatik olarak yayından kaldırmak için postScheduledDates.startDatetime/endDatetime kullanın.
  • postSites içindeki her site için bir postMessage girdisi sağlayın.
  • Tarih içermeyen düz bir mesaj için duyuruları; kuponlar/indirimler için teklifleri kullanın.

Yazma işlemi: canlı hesap üzerinde yürütülmemiştir. Gösterilen istek ve yanıt, API şemasından oluşturulmuştur; bu işlem çalıştırıldığında gerçek Google/Facebook profillerinde gönderi yayımlar.

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