POST/api/v4/posts

Buat postingan acara

Membuat postingan sosial EVENT dengan judul dan rentang waktu mulai/selesai, yang dipublikasikan ke situs yang dipilih untuk satu atau beberapa lokasi.

Memerlukan kunci API. Lihat Autentikasi untuk format header dan rotasi kunci.

Parameter

Body

NamaTipeWajibDeskripsi
inputobjectwajibWrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.postNamestringwajibInternal name for the campaign (not shown to customers).
input.locationIdsarray of stringswajibBase64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`).
input.postTypestringwajibMust be `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT.
input.postSitesarray of stringswajibSites to publish to: `GOOGLE`, `FACEBOOK`.
input.postContextInfoobjectopsionalEvent 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 objectsopsionalPer-site body text: `{ site, message }`. One entry per site in `postSites`.
input.postScheduledDatesobjectopsionalWhen to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`.
input.postCtaarray of objectsopsionalOptional call-to-action per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER.
input.postMediaUrlarray of objectsopsionalOptional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO.
input.clientMutationIdstringopsionalOptional client token returned unchanged in the response for correlation.

Contoh permintaan

Body siap tempel. Ganti ID dan nilai placeholder dengan milik Anda.

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

Respons

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.

Membuat postingan acara: pengumuman bertanggal dengan title dan rentang waktu mulai/selesai yang ditampilkan sebagai kartu acara di Google. Jadwal acara itu sendiri ada di postContextInfo (title, startDay, startTime, endDay, endTime); postScheduledDates yang opsional mengatur kapan postingan itu sendiri dipublikasikan dan ditarik, yang biasanya mencakup periode menjelang acara.

Kasus penggunaan: promosikan acara di toko. Umumkan "Pembukaan Promo Musim Panas" untuk Jenny Home dengan rentang waktu acara pada 15 Juli dan CTA LEARN_MORE yang mengarah ke halaman acara. Tetapkan postType: "EVENT" dan isi postContextInfo.title; Google menolak acara tanpa judul. Pemanggilan ini mengembalikan status: INPROGRESS; pastikan melalui GET /posts/{postId} bahwa statusnya mencapai SUCCESS.

Catatan.

  • Isi permintaan harus dibungkus dalam objek input: setiap field merupakan properti dari input. Isi permintaan datar tanpa pembungkus ditolak dengan HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided).
  • postContextInfo berisi tanggal acara; postScheduledDates berisi tanggal publikasi. Gunakan postScheduledDates.startDatetime/endDatetime untuk menjadwalkan postingan terlebih dahulu dan mengakhiri masa berlakunya secara otomatis setelah acara.
  • Sediakan entri postMessage untuk setiap situs di postSites.
  • Untuk pesan biasa tanpa tanggal, gunakan pengumuman; untuk kupon/diskon, gunakan penawaran.

Operasi tulis: tidak dijalankan pada akun aktif. Permintaan dan respons yang ditampilkan disusun berdasarkan skema API; operasi ini memublikasikan postingan ke profil Google/Facebook sungguhan saat dijalankan.

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