회원 저장

회원 레코드를 생성하거나 업데이트합니다. API는 member_id를 기준으로 생성할지 업데이트할지 결정합니다.

매개변수

  • members array 필수

    저장할 회원 객체의 배열입니다. 최적의 성능을 위해 요청당 최대 1000개 항목을 권장합니다. API는 처리를 위해 항목을 자동으로 배치로 묶습니다. 각 항목에는 facility_id(linking_identifier를 사용하지 않는 경우 필수) 또는 linking_identifier(facility_id를 사용하지 않는 경우 필수)가 포함되어야 합니다.

    회원에 access_time_windows가 포함된 경우 access_time_windows_revision도 포함해야 합니다. 이 배열은 패치가 아닌 완전한 원본 스냅샷입니다. 기존 스냅샷을 유지하려면 생략하고, 원본 소유 시간 창을 모두 취소하려면 더 새로운 리비전과 함께 []를 보내십시오. 이 필드를 활성화하기 전에 Access Time Windows 가이드를 읽으십시오.

반환값

동기화 작업을 확인하는 간단한 메시지를 반환합니다.

시간 창 스냅샷이 멱등 재전송 또는 오래된 데이터 건너뛰기로 보고되더라도 회원 프로필 필드는 일반 업서트로 처리됩니다. 같은 리비전/다른 페이로드로 충돌하는 스냅샷은 변경하지 않고 재시도할 수 없습니다. 원본 상태를 조정하고 더 새로운 리비전을 보내십시오.

요청

curl -X POST https://partner-api.performancehub.co/partner/v1/members \
  -u sk_live_YOUR_PARTNER_SECRET_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "members": [
      {
        "member_id": "member_11111",
        "facility_id": "550e8400-e29b-41d4-a716-446655440000",
        // "linking_identifier": "branch_downtown",  // If using linking identifier
        "first_name": "John",
        "last_name": "Smith",
        "email": "john.smith@example.com",
        "mobile_phone": "+61 412 345 678",
        "date_of_birth": "1985-06-15",
        "gender": "male",
        "type": "member",
        "tags": ["vip", "personal-training"],
        "profile_picture": "/9j/4AAQSkZJRgABAQAAAQ...",
        "membership_status": "current",
        "created": "2024-01-15T10:30:00Z",
        "updated": "2024-01-20T14:45:00Z",
        "access_time_windows_revision": 1842,
        "access_time_windows": [
          {
            "external_id": "access-4b1782",
            "kind": "absolute",
            "from": 1792053000,
            "to": 1792058400,
            "timezone": "Australia/Perth",
            "scope_key": "after_hours_entry",
            "label": "Temporary site access"
          }
        ],
        "address": {
          "address_line_1": "456 Bourke Street",
          "address_line_2": "Apt 12",
          "city": "Melbourne",
          "state": "VIC",
          "postal_code": "3000",
          "country": "AU",
          "country_name": "Australia"
        },
        "membership_plans": [
          {
            "membership_plan_id": "plan_99999",
            "name": "Unlimited Monthly",
            "start_date": "2024-01-01T00:00:00Z",
            "status": "current",
            "is_current": true,
            "end_date": null
          }
        ]
      }
    ]
  }'

응답

동기화 작업에 대한 메타데이터와 함께 성공 메시지를 반환합니다.

{
  "message": "Member sync successful.",
  "metadata": {
    "success": 245,
    "skipped": 5,
    "skipped_items": [
      {
        "member_id": "member_123",
        "facility_id": null,
        "reason": "Facility integration is disabled in facility-partner-config"
      }
    ]
  }
}

메타데이터 필드:

  • success - 성공적으로 처리된 회원 수
  • skipped - 건너뛴 회원 수(있는 경우)
  • skipped_items - 건너뛴 회원과 그 사유의 배열(있는 경우)
  • dry-run - dryrun 키 유형을 사용하는 경우의 부울 플래그(해당하는 경우)