تتضمّن واجهة برمجة التطبيقات لأداء الأعمال في Google طريقة واجهة برمجة تطبيقات جديدة تتيح جلب عدة "مقاييس يومية" في طلب واحد لواجهة برمجة التطبيقات. يُرجى مراجعة الجدول الزمني للإيقاف وتعليمات نقل البيانات من طريقة v4 reportInsights API إلى واجهة برمجة التطبيقات الخاصة بأداء "الملف التجاري على Google".
قبل استخدام Google My Business API، عليك تسجيل تطبيقك
والحصول على بيانات اعتماد OAuth 2.0.
لمعرفة التفاصيل حول كيفية بدء استخدام واجهة برمجة تطبيقات "نشاطي التجاري على Google"، اطّلِع على الإعداد
الأساسي.
مشاركات الأحداث
يمكنك إرسال إشعار إلى عملائك بشأن الحدث القادم في نشاطك التجاري من خلال مشاركة. يتضمّن
المشاركة الخاصة بالحدث تواريخ البدء والانتهاء والأوقات، ويتم عرضها
بشكل بارز في المشاركة.
تتضمّن المشاركات التي تتضمّن عبارة تحثّ المستخدم على اتّخاذ إجراء زرًا. يتم تحديد النص المعروض على زر عبارة الحث على اتخاذ إجراء
بواسطة حقل actionType في المشاركة. تتم إضافة رابط يؤدي إلى عنوان URL يقدّمه المستخدم إلى الزر.
لإنشاء مشاركة تتضمّن زرًّا للحثّ على اتّخاذ إجراء، استخدِم ما يلي:
يمكن أن تحتوي المشاركات التي تحثّ على اتّخاذ إجراء على أنواع إجراءات مختلفة تحدّد نوع
المشاركات التي تحثّ على اتّخاذ إجراء.
في ما يلي أنواع عبارات الحثّ على اتّخاذ إجراء المتوافقة:
أنواع الإجراءات
BOOK
تُنشئ مشاركة تطلب من المستخدم حجز موعد أو طاولة أو
إجراء مشابه.
ORDER
تُنشئ مشاركة تطلب من المستخدم طلب منتج معيّن.
SHOP
تُنشئ مشاركة تطلب من المستخدم تصفُّح كتالوج المنتجات.
LEARN_MORE
لإنشاء مشاركة تطلب من المستخدم الاطّلاع على تفاصيل إضافية على
موقع إلكتروني.
SIGN_UP
تُنشئ مشاركة تطلب من المستخدم التسجيل أو الاشتراك أو الانضمام
إلى شيء ما.
CALL
إنشاء مشاركة تطلب من المستخدم الاتصال بنشاط تجاري
المشاركات التي تتضمّن عروضًا
لإنشاء مشاركة عرض، استخدِم ما يلي:
بروتوكول HTTP
$POST
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/localPosts
{"languageCode":"en-US",
"summary":"Buy one Google jetpack, get a second one free!!",
"offer":{"couponCode":“BOGO-JET-CODE”,
"redeemOnlineUrl":“https://www.google.com/redeem”,
"termsConditions":“Offeronlyvalidifyoucanproveyouareatimetraveler”
},
"media":[{"mediaFormat":"PHOTO",
"sourceUrl":"https://www.google.com/real-jetpack-photo.jpg",
}],
"topicType":"OFFER"}
تعديل المشاركات
بعد إنشاء مشاركة، يمكنك تعديلها من خلال طلب PATCH.
لتعديل مشاركة، اتّبِع الخطوات التالية:
بروتوكول HTTP
$PATCH
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/localPosts/{localPostId}?updateMask=summary
{"summary":"Order your Christmas turkeys now!!"}
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Google My Business API allows you to create and manage posts for your business directly on Google Search and Maps, including Event, Call to Action, and Offer posts, to engage with your customers.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API, you must register your application and obtain OAuth 2.0 credentials, following the setup instructions provided in the documentation.\u003c/p\u003e\n"],["\u003cp\u003eYou can create posts with various features, like event schedules, call-to-action buttons with customizable actions (book, order, shop, etc.), and offer details like coupon codes and terms.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating posts, the API enables you to edit their content or delete them entirely using dedicated HTTP methods and specifying the desired changes or target post ID.\u003c/p\u003e\n"],["\u003cp\u003eProduct posts cannot be created using the Google My Business API at this time.\u003c/p\u003e\n"]]],[],null,["# Create Posts on Google\n\n\u003cbr /\u003e\n\nThe Google My Business API provides you with the ability to create Posts in\nGoogle Search within several categories, such as news, events, and offers.\n\nThis tutorial shows you how to do the following:\n\n- Create [Event Posts](#event_posts).\n- Create [Call to action Posts](#call_to_action_posts).\n- Create [Offer Posts](#offer_posts).\n- [Edit Posts](#edit_posts).\n- [Delete Posts](#delete_posts).\n\n| **Note:** Product Posts cannot be created via the Google My Business API at this time.\n\nBefore you begin\n----------------\n\nBefore you use the Google My Business API, you need to register your application\nand obtain OAuth 2.0 credentials.\n\nFor details on how to get started with the Google My Business API, see [Basic\nsetup](/my-business/content/basic-setup).\n| **Note:** Small businesses and large chains are eligible to create Posts.\n\nEvent Posts\n-----------\n\nNotify your customers about the next event at your business with a Post. Your\nPost for an event includes start and end dates and times, which display\nprominently on the Post.\n\nTo make a Post to an account associated with a user, use the\n[`accounts.locations.localPosts`](/my-business/reference/rest/v4/accounts.locations.localPosts#LocalPost) API.\n\nTo create a Post for an authenticated user, use the following:\nHTTP \n\n```bash\n$ POST\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/localPosts\n{\n \"languageCode\": \"en-US\",\n \"summary\": \"Come in for our spooky Halloween event!\",\n \"event\": {\n \"title\": \"Halloween Spook-tacular!\",\n \"schedule\": {\n \"startDate\": {\n \"year\": 2017,\n \"month\": 10,\n \"day\": 31,\n },\n \"startTime\": {\n \"hours\": 9,\n \"minutes\": 0,\n \"seconds\": 0,\n \"nanos\": 0,\n },\n \"endDate\": {\n \"year\": 2017,\n \"month\": 10,\n \"day\": 31,\n },\n \"endTime\": {\n \"hours\": 17,\n \"minutes\": 0,\n \"seconds\": 0,\n \"nanos\": 0,\n },\n }\n },\n \"media\": [\n {\n \"mediaFormat\": \"PHOTO\",\n \"sourceUrl\": \"https://www.google.com/real-image.jpg\",\n }\n ],\n \"topicType\": \"EVENT\"\n}\n```\n\nCall to action Posts\n--------------------\n\nPosts with a call to action include a button. The text on the call to action\nbutton is determined by the `actionType` field of the Post. A link to a\nuser-provided URL is added to the button.\n\nTo create a Post with a call to action button, use the following:\nHTTP \n\n```bash\n$ POST\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/localPosts\n{\n \"languageCode\": \"en-US\",\n \"summary\": \"Order your Thanksgiving turkeys now!!\",\n \"callToAction\": {\n \"actionType\": \"ORDER\",\n \"url\": \"http://google.com/order_turkeys_here\",\n },\n \"media\": [\n {\n \"mediaFormat\": \"PHOTO\",\n \"sourceUrl\": \"https://www.google.com/real-turkey-photo.jpg\",\n }\n ],\n \"topicType\": \"OFFER\"\n}\n```\n\n### Action types\n\nThe call to action Posts can have different action types that determine the type\nof call to action Post.\n\nThe following are the supported call to action types:\n\n| Action types ||\n|--------------|-----------------------------------------------------------------------------------------|\n| `BOOK` | Creates a Post that prompts a user to book an appointment, table, or something similar. |\n| `ORDER` | Creates a Post that prompts a user to order something. |\n| `SHOP` | Creates a Post that prompts a user to browse a product catalog. |\n| `LEARN_MORE` | Creates a Post that prompts a user to see additional details on a website. |\n| `SIGN_UP` | Creates a Post that prompts a user to register, sign up, or join something. |\n| `CALL` | Creates a Post that prompts a user to call a business. |\n\nOffer Posts\n-----------\n\nTo create an Offer Post, use the following:\nHTTP \n\n```bash\n$ POST\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/localPosts\n{\n \"languageCode\": \"en-US\",\n \"summary\": \"Buy one Google jetpack, get a second one free!!\",\n \"offer\": {\n \"couponCode\": “BOGO-JET-CODE”,\n \"redeemOnlineUrl\": “https://www.google.com/redeem”,\n \"termsConditions\": “Offer only valid if you can prove you are a time traveler”\n },\n \"media\": [\n {\n \"mediaFormat\": \"PHOTO\",\n \"sourceUrl\": \"https://www.google.com/real-jetpack-photo.jpg\",\n }\n ],\n \"topicType\": \"OFFER\"\n}\n```\n\nEdit Posts\n----------\n\nOnce a post is created, you can edit it with a `PATCH` request.\n\nTo edit a Post, use the following:\nHTTP \n\n```bash\n$ PATCH\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/localPosts/{localPostId}?updateMask=summary\n{\n \"summary\": \"Order your Christmas turkeys now!!\"\n}\n```\n\nDelete Posts\n------------\n\nAfter a Post is created, you can delete it with a `DELETE` request.\n\nTo delete a Post, use the following:\nHTTP \n\n```bash\n$ DELETE\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/localPosts/{localPostId}\n```"]]