Skip to content
Last updated

Conflict resolution

When pushing member data to EGYM, conflicts can occur due to uniqueness constraints and existing data. Understanding and properly handling these conflicts is critical for successful PUSH integration.

Required for PUSH integration

Implementing proper conflict resolution is not optional. Your integration MUST handle these conflict scenarios to ensure reliable member data synchronization. All conflicts return HTTP 409 status codes with specific error codes and resolution guidance.

Why conflicts occur

EGYM enforces strict uniqueness rules within each gym chain to maintain data integrity:

  • Email addresses must be unique per gym chain
  • Membership IDs must be unique per gym chain

Conflicts typically happen when:

  • Attempting to create a new member with an email/membershipId that already exists
  • Updating a member's email to one that's already in use
  • Multiple profiles exist for the same physical person
  • Migrating data from legacy systems

Common conflict scenarios

409 Membership conflict

When it occurs: You attempt to create a new member with a new membershipId but the email already belongs to another member in the gym chain.

Response example:

{
  "timestamp": "2023-04-11T14:35:48.499+0000",
  "path": "/api/v2/accounts",
  "status": 409,
  "error": "Conflict",
  "errorCode": "membershipExists",
  "message": "Membership conflicts with another account.",
  "metadata": {
    "accountId": "f756ae43-c932-5a02-b42b-b4752f73er12"
  }
}

How to resolve:

Option A - Change email:

  • Modify the email address for the target member in your MMS
  • Retry the synchronization with the new email

Option B - Remove conflicting membership:

  • Delete the conflicting member's gym chain profile using Delete an account API
  • Use the accountId provided in the error response
  • Retry synchronization for the target member

Recommended approach: Review both accounts to determine if they represent the same physical person. If so, use Option B to consolidate into a single EGYM account.


409 MembershipId already exists

When it occurs: You attempt to create a new member with a membershipId that already exists for another member in the gym chain.

Response example:

{
  "timestamp": "2023-04-13T12:45:45.338+0000",
  "path": "/api/v2/accounts",
  "status": 409,
  "error": "Conflict",
  "errorCode": "membershipExists",
  "message": "This membershipId already exists.",
  "metadata": {
    "accountId": "5a34497b-3358-4f43-a90e-70037e328e98"
  }
}

How to resolve:

Option A - Change membershipId:

  • Assign a different membershipId to the target member in your MMS
  • Retry the synchronization

Option B - Update existing member:

  • Update the membershipId for the conflicting member using Update an account API
  • Use the accountId provided in the error response
  • Retry synchronization

Option C - Delete conflicting membership:

  • Delete the conflicting member using Delete an account API
  • Use the accountId provided in the error response
  • Retry synchronization for the target member

Recommended approach: Investigate whether this is a data quality issue in your MMS. MembershipIds should be unique within your system before syncing to EGYM.


409 Email conflict

When it occurs: You attempt to update an existing member's email to an address that already belongs to another member in the gym chain.

Response example:

{
  "timestamp": "2023-04-13T12:17:32.534+0000",
  "path": "/api/v2/accounts/00bd79e2-8ba4-5b82-980b-756362cf9909",
  "status": 409,
  "error": "Conflict",
  "errorCode": "userEmailConflict",
  "message": "The email you sent is already used within your gym or chain",
  "metadata": {
    "accountId": "f756ae43-c932-5a02-b42b-b4752f73er12"
  }
}

Resolution:

Option A - Change email:

  • Modify the email address for the target member in your MMS
  • Retry the synchronization

Option B - Delete conflicting member:

  • Delete the conflicting member's gym chain profile using Delete an account API with eraseMemberData=true
  • Use the accountId provided in the error response (or find it via GET member by email endpoint)
  • Retry synchronization for the target member

Recommended approach: Verify if both accounts represent the same person. Email conflicts often indicate duplicate member records that should be consolidated.


409 Wellpass TAN conflict

When it occurs: A member attempts to use Wellpass, but the Wellpass membership (TAN) is associated with a different EGYM account than the one linked to their regular gym membership.

Response example:

{
  "timestamp": "2023-06-01T12:17:32.534+0000",
  "path": "/api/v2/accounts/00bd79e2-8ba4-5b82-980b-756362cf9909",
  "status": 409,
  "error": "Conflict",
  "errorCode": "tanAssociatedWithAnotherAccount",
  "message": "The provided TAN is associated with another account",
  "metadata": {
    "accountId": "f756ae43-c932-5a02-b42b-b4752f73er12"
  }
}

How to resolve:

Important member impact

This resolution requires re-linking the member's account, which means machine settings and workout history will remain with the old EGYM account. The member will need to be onboarded to machines again. Consider displaying a confirmation message to explain this impact before proceeding.

Resolution steps:

  1. Delete the existing member's gym chain profile using Delete an account API with eraseMemberData=true
  2. Remove the EGYM accountId from your MMS database
  3. Create the member again, specifying:
    • The TAN from the EGYM account with the Wellpass membership
    • CORPORATE_FITNESS as the membership type
  4. Remap any RFID cards to the new member account in EGYM

Best practices for conflict handling

  1. Implement automated conflict detection - Monitor for 409 responses and log them for analysis
  2. Store accountId mappings - Maintain a mapping between your MMS member IDs and EGYM accountId values
  3. Validate data before sync - Check for duplicate emails and membershipIds in your MMS before pushing to EGYM
  4. Provide user-friendly error messages - Translate technical conflict errors into actionable messages for gym staff
  5. Implement retry logic - After resolving a conflict, automatically retry the failed synchronization
  6. Log conflict resolutions - Track which resolution option was used for auditing and pattern analysis

Testing conflict scenarios

Before going live, test your conflict handling implementation:

  1. Test duplicate email creation - Attempt to create two members with the same email
  2. Test duplicate membershipId - Attempt to create two members with the same membershipId
  3. Test email update conflict - Update a member's email to one that already exists
  4. Test conflict resolution APIs - Verify that your code can successfully resolve conflicts using the DELETE and PUT endpoints
  5. Test error logging - Ensure conflicts are properly logged for monitoring