/api/v4/postsDuyuru gönderisi oluşturma
Bir veya daha fazla konum için ANNOUNCEMENT türünde bir sosyal medya gönderisi oluşturur ve seçilen sitelerde yayımlar.
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 `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | zorunlu | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postMessage | array of objects | isteğe bağlı | Per-site body text: `{ site, message }`. Provide one entry per site in `postSites`. |
| input.postCta | array of objects | isteğe bağlı | Optional call-to-action button 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": "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" } ] }}Yanıtlar
200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
{ "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.
En basit gönderi türü olan bir duyuru oluşturur. Duyuru, etkinlik tarihleri veya teklif ayrıntıları içermeyen düz bir mesaj (ve isteğe bağlı bir CTA ile görsel) içerir. postType: "ANNOUNCEMENT" değerini ve postSites içinde her site için bir postMessage girdisi iletin.
Kullanım senaryosu: Tüm mağazalarınız için "Açığız" duyurusu. Tek bir çağrıyla bir grup konumun büyük açılışını veya yeni çalışma saatlerini Google'da (ve Facebook'ta) duyurun. Daha zengin bir kart için sitenize bağlantı veren bir LEARN_MORE CTA'sı ve bir görsel sağlayın. Çağrı hemen status: INPROGRESS döndürür; döndürülen socialPost.id ile GET /posts/{postId} uç noktasını durum SUCCESS olana kadar düzenli aralıklarla sorgulayın ve herhangi bir sitede işlem başarısız olursa publishDetails[].submissionError değerini okuyun.
Notlar.
- İstek gövdesi bir
inputnesnesi içine alınmalıdır: her alan (postName,locationIds,postType,postSites, …),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. postSitesve herpostMessage.site, site enum değerlerini (GOOGLE,FACEBOOK) kullanır; hedeflediğiniz her site için bir mesaj girdisi sağlayın.- Aynı duyuruyu çok sayıda konum için yayımlamak üzere burada tüm ID değerlerini
locationIdsiçinde iletin veya çok sayıda konumu kapsayan büyük ölçekli yayımlama işlemleri içinPOST /bulk-postskullanın. - Tarih içeren gönderiler için etkinlikleri; kuponlar/indirimler için teklifleri kullanın.
Yazma işlemi: canlı hesapta 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": "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" } ] } }'