/api/v4/postsEtkinlik 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.
Parametreler
Gövde
| Ad | Tür | Zorunlu | Açıklama |
|---|---|---|---|
| input | object | zorunlu | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | zorunlu | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | zorunlu | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | zorunlu | Must be `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | zorunlu | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postContextInfo | object | isteğ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.postMessage | array of objects | isteğe bağlı | Per-site body text: `{ site, message }`. One entry per site in `postSites`. |
| input.postScheduledDates | object | isteğe bağlı | When to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`. |
| input.postCta | array of objects | isteğ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.postMediaUrl | array of objects | isteğe bağlı | Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO. |
| input.clientMutationId | string | isteğ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.
{ "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.
{ "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
inputnesnesi içine alınmalıdır: her alan,inputnesnesinin 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;postScheduledDatesise yayımlama tarihlerini içerir. Gönderiyi önceden planlamak ve etkinlikten sonra otomatik olarak yayından kaldırmak içinpostScheduledDates.startDatetime/endDatetimekullanın.postSitesiçindeki her site için birpostMessagegirdisi 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.
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" } ] } }'