שמירת תוכנית חברות
יוצר או מעדכן רשומות של תוכניות חברות. ה-API קובע אם ליצור או לעדכן על סמך ה-membership_plan_id.
פרמטרים
-
membership_plans
arrayחובהמערך של אובייקטי Membership Plan לשמירה. מקסימום מומלץ: 1000 פריטים לבקשה לביצועים מיטביים. ה-API מחלק את הפריטים לאצוות לעיבוד באופן אוטומטי. כל פריט חייב לכלול את
facility_id(חובה אם לא משתמשים ב-linking_identifier) או אתlinking_identifier(חובה אם לא משתמשים ב-facility_id).
ערך מוחזר
מחזיר הודעה פשוטה שמאשרת את פעולת הסנכרון.
בקשה
דוגמה זו משתמשת ב-facility_id. באינטגרציה מסוג linking-identifier, שלחו במקום זאת "linking_identifier": "branch_downtown".
curl -X POST https://partner-api.performancehub.co/partner/v1/membership-plans \
-u sk_live_YOUR_PARTNER_SECRET_KEY: \
-H "Content-Type: application/json" \
-d '{
"membership_plans": [
{
"membership_plan_id": "plan_99999",
"facility_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Student – term access",
"description": "Library and student hub access for one teaching term",
"billing_cycle": "one_time",
"price": 4500,
"currency": "AUD",
"duration_days": 84,
"is_recurring": false,
"is_trial": false,
"visible_to_public": true,
"active_members": 245,
"access_zones": [
{
"name": "Library",
"description": "Reading rooms, study spaces and bookable rooms",
"access_hours": {
"mon": [["08:00", "21:00"]],
"tue": [["08:00", "21:00"]],
"wed": [["08:00", "21:00"]],
"thu": [["08:00", "21:00"]],
"fri": [["08:00", "17:00"]],
"sat": [["09:00", "13:00"]]
}
},
{
"name": "Student Hub",
"description": "Common room, kitchen and lockers",
"access_hours": {
"mon": [["07:00", "22:00"]],
"tue": [["07:00", "22:00"]],
"wed": [["07:00", "22:00"]],
"thu": [["07:00", "22:00"]],
"fri": [["07:00", "22:00"]]
}
}
],
"class_limit": null
}
]
}'
תגובה
מחזיר הודעת הצלחה עם מטא-נתונים על פעולת הסנכרון.
{
"message": "Membership plan sync successful.",
"metadata": {
"success": 98,
"skipped": 2,
"skipped_items": [
{
"membership_plan_id": "plan_456",
"facility_id": null,
"reason": "Missing facility_id"
}
]
}
}
שדות המטא-נתונים:
- success - מספר תוכניות החברות שעובדו בהצלחה
- skipped - מספר התוכניות שדולגו (אם יש)
- skipped_items - מערך של התוכניות שדולגו, עם הסיבות (אם יש)
- dry-run - דגל בוליאני אם נעשה שימוש במפתח מסוג dryrun (אם רלוונטי)