تتيح لك الإشعارات في الوقت الفعلي إبقاء مستودع العروض متزامنًا مع Google. يمكنك إرسال التعديلات المتزايدة في الوقت الفعلي تقريبًا. سيجمع نظامنا التغييرات من "الملخّص" و"الوحدات في الوقت الفعلي" لعرض أحدث المعلومات للمستخدمين.
نقاط نهاية واجهة برمجة التطبيقات
لإرسال التعديلات في الوقت الفعلي أو حذفها، استخدِم نقاط نهاية REST API التالية:
إرسال دفعي
- وضع الحماية:
https://partnerdev-mapsbooking.googleapis.com/v1alpha/inventory/partners/{partner_id}/feeds/google.offer/record:batchPush - الإنتاج:
https://mapsbooking.googleapis.com/v1alpha/inventory/partners/{partner_id}/feeds/google.offer/record:batchPush
الحذف المجمّع
- وضع الحماية:
https://partnerdev-mapsbooking.googleapis.com/v1alpha/inventory/partners/{partner_id}/feeds/google.offer/record:batchDelete - الإنتاج:
https://mapsbooking.googleapis.com/v1alpha/inventory/partners/{partner_id}/feeds/google.offer/record:batchDelete
لمزيد من المعلومات حول تعريف عنصر JSON الخاص بالعرض الترويجي، يمكنك الاطّلاع على العرض الترويجي. لمزيد من التفاصيل حول سمات العروض، انتقِل إلى صفحة مرجع العروض.
كيفية المصادقة على واجهة برمجة التطبيقات
لربط حسابك بواجهة برمجة التطبيقات، يُرجى الرجوع إلى المصادقة باستخدام Mapsbooking API.
القيود
عند استخدام واجهة برمجة التطبيقات الخاصة بالتحديثات في الوقت الفعلي، يجب مراعاة القيود التالية:
- protoRecord Only: تم ضبط واجهة برمجة التطبيقات لاستخدام
protoRecordفقط (وليسdataRecord). - حدود الحصة: تبلغ حصة واجهات برمجة التطبيقات هذه 1500 طلب في الدقيقة لكل حساب شريك. يقتصر كل طلب على إرسال 1000 سجلّ للإدراج أو التعديل أو الحذف.
- قيود ربط الكيانات: يمكن للشركاء إرسال تعديل لرقم تعريف الجهة واحد لكل عرض. إذا كنت تريد تعديل العرض نفسه على أرقام تعريف كيانات متعدّدة، على الشريك إرسال سجلّ واحد لكل
entityId. يجب أن تكون قيمةentityIdدائمًا مفردة لكل سجلّ. - عروض الحزمة الإضافية: بسبب القيود المفروضة على ربط الكيانات، لا تتوافق عروض الحزمة الإضافية التي تتضمّن القيمة
addOnOfferApplicableToAllEntitiesمع تحديث RTU، ولا يمكن تعديلها بهذه الطريقة (يمكن تعديلها فقط من خلال الخلاصات).
مثال
مثال على التعديلات المُجمَّعة
في ما يلي مثال على إرسال تحديث في الوقت الفعلي باستخدام curl:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token --impersonate-service-account=test@myproject.gserviceaccount.com --scopes=https://www.googleapis.com/auth/mapsbooking)" \
-H "Content-Type: application/json" \
-d '{
"records": [
{
"generationTimestamp": {
"seconds": 100
},
"protoRecord": {
"@type": "type.googleapis.com/madden.ingestion.offer.Offer",
"offerId": "1",
"entityIds": [
"1234567890"
],
"addOnOfferApplicableToAllEntities": false,
"offerSource": "OFFER_SOURCE_AGGREGATOR",
"actionType": "ACTION_TYPE_FOOD_DELIVERY",
"offerModes": [
"OFFER_MODE_WALK_IN"
],
"offerCategory": "OFFER_CATEGORY_BASE_OFFER",
"tags": [
"OFFER_TAG_NEW_YEAR_SPECIAL"
],
"offerDetails": {
"offerDisplayText": "FLAT 10% off",
"offerSummaryText": "MONDAY TO FRIDAY",
"discountPercent": 10
},
"offerRestrictions": {
"combinableWithOtherOffers": true,
"inclusions": [
{
"description": "complementary drink"
},
{
"description": " starters"
}
],
"exclusions": [
{
"description": "taxes and Tips"
}
]
},
"validityPeriods": [
{
"timeOfDay": {
"timeWindows": [
{
"openTime": {
"hours": 10
},
"closeTime": {
"hours": 20
}
}
]
},
"validPeriod": {
"validFromTime": {
"seconds": 10
}
}
}
],
"offerUrl": "https://www.google.com/offer"
}
}
]
}' \
https://partnerdev-mapsbooking.googleapis.com/v1alpha/inventory/partners/20000123/feeds/google.offer/record:batchPush
مثال على الحذف المجمّع
في ما يلي مثال على حذف عرض من خلال curl:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token --impersonate-service-account=test@myproject.gserviceaccount.com --scopes=https://www.googleapis.com/auth/mapsbooking)" \
-H "Content-Type: application/json" \
-d '{
"records": [
{
"deleteTime": {
"seconds": 150
},
"protoRecord": {
"@type": "type.googleapis.com/madden.ingestion.offer.Offer",
"offerId": "1",
"entityIds": [
"1234567890"
]
}
}
]
}' \
https://partnerdev-mapsbooking.googleapis.com/v1alpha/inventory/partners/20000123/feeds/google.offer/record:batchDelete