POST/api/v4/posts

Duyuru 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.

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 `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringszorunluSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postMessagearray of objectsisteğe bağlıPer-site body text: `{ site, message }`. Provide one entry per site in `postSites`.
input.postCtaarray of objectsisteğ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.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": "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.
Response
{  "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 input nesnesi içine alınmalıdır: her alan (postName, locationIds, postType, postSites, …), 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.
  • postSites ve her postMessage.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 locationIds içinde iletin veya çok sayıda konumu kapsayan büyük ölçekli yayımlama işlemleri için POST /bulk-posts kullanı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.

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