Skip to content
Last updated

Push member data to EGYM

This guide shows you how to push member data to EGYM using the MMS API v2. You'll learn how to create member accounts, update member information, manage profile pictures, assign roles, and perform other essential operations for keeping member data synchronized.

Member account operations

Create a member account

To create a new member account, send a POST request with the member's details:

curl -i -X POST \
  https://one-mms-service.ext-1.test.co.egym.coffee/api/v2/accounts \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY_HERE' \
  -d '{
    "email": "john.wick@mailinator.com",
    "firstName": "John",
    "lastName": "Wick",
    "gender": "MALE",
    "membership": {
      "membershipId": "string",
      "membershipType": "BASIC",
      "endOfContract": "2019-08-24",
      "startOfContract": "2022-08-24"
    }
  }'

Response:

A successful request returns a 201 Created status with the member account details. Save the accountId from the response - you'll need it for all subsequent operations.


Update member information (full update)

Use PUT to replace all member account data. This is ideal when you have the complete, updated member record:

Method: PUT /api/v2/accounts/{accountId}

curl -i -X PUT \
  'https://one-mms-service.ext-1.test.co.egym.coffee/api/v2/accounts/{accountId}' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY_HERE' \
  -d '{
    "email": "john.wick@mailinator.com",
    "firstName": "John",
    "lastName": "Wick",
    "gender": "MALE",
    "membership": {
      "membershipId": "string",
      "membershipType": "PREMIUM",
      "endOfContract": "2025-12-31",
      "startOfContract": "2022-08-24"
    }
  }'

When to use PUT:

  • You have the complete member record available
  • You want to ensure all fields are set to specific values
  • You're performing a full synchronization

Important notes:

  • Replace {accountId} with the member's actual accountId
  • PUT replaces the entire member account data - include all required fields
  • Missing fields may be set to null or default values
  • Returns 200 OK with the updated member account

Update member information (partial update)

Use PATCH to update only specific fields without affecting other data. This is more efficient for small, incremental changes:

Method: PATCH /api/v2/accounts/{accountId}

curl -i -X PATCH \
  'https://one-mms-service.ext-1.test.co.egym.coffee/api/v2/accounts/{accountId}' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY_HERE' \
  -d '{
    "membership": {
      "membershipType": "PREMIUM",
      "endOfContract": "2025-12-31"
    }
  }'

When to use PATCH:

  • You only need to update specific fields (e.g., just the contract end date)
  • You want to avoid sending the entire member record
  • You're making incremental changes (membership upgrade, email change, etc.)

Important notes:

  • Only include the fields you want to update
  • Null or missing fields in the request are ignored (existing values preserved)
  • More efficient than PUT for small changes
  • Returns 200 OK with the complete updated member account

Example use cases:

  • Extend membership contract: Send only membership.endOfContract
  • Upgrade membership: Send only membership.membershipType
  • Update email: Send only email
  • Update phone: Send only phoneNumber

Profile picture operations

Upload a profile picture

Once you've created a member account, you can add a profile picture:

curl -i -X PUT \
  'https://one-mms-service.ext-1.test.co.egym.coffee/api/v2/accounts/{accountId}/images' \
  -H 'Content-Length: 0' \
  -H 'Content-Type: multipart/form-data' \
  -H 'x-api-key: YOUR_API_KEY_HERE'

Replace {accountId} with the member's accountId.


Delete a profile picture

To remove a member's profile picture:

curl -i -X DELETE \
  'https://one-mms-service.ext-1.test.co.egym.coffee/api/v2/accounts/{accountId}/images' \
  -H 'x-api-key: YOUR_API_KEY_HERE'

Role management

Assign trainer or gym owner rights

Grant special permissions to member accounts for trainer or administrative access:

curl -i -X POST \
  'https://one-mms-service.ext-1.test.co.egym.coffee/api/v2/accounts/{accountId}/roles' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY_HERE' \
  -d '{
    "trainer": true,
    "gymOwner": false
  }'

Role options:

  • trainer: true - Grants trainer rights (access to Trainer App and trainer features)
  • gymOwner: true - Grants gym owner/admin rights
  • Set to false to revoke permissions

Handling conflicts (CRITICAL)

Conflict resolution is required

When pushing data to EGYM, you MUST implement proper conflict resolution. This is not optional - conflicts will occur due to uniqueness constraints, and your integration must handle them automatically.

Why conflicts happen

EGYM enforces strict uniqueness rules per gym chain:

  • Email addresses must be unique
  • Membership IDs must be unique

Conflicts commonly occur when:

  • Creating a member with an email/membershipId that already exists
  • Updating a member's email to one already in use

Common conflict scenarios

409 Membership conflict - Email already exists for a different member 409 MembershipId conflict - MembershipId already exists for a different member 409 Email conflict - Attempting to update to an email that's already in use

All conflict responses include:

  • HTTP 409 status code
  • Specific errorCode identifying the conflict type
  • The conflicting accountId in the response metadata

Your integration must:

  1. Detect 409 responses - Monitor for HTTP 409 status codes
  2. Parse the error - Extract errorCode and accountId from the response
  3. Resolve automatically - Implement logic to handle each conflict type
  4. Retry - Automatically retry after resolution

Example conflict response:

{
  "status": 409,
  "errorCode": "membershipExists",
  "message": "Membership conflicts with another account.",
  "metadata": {
    "accountId": "f756ae43-c932-5a02-b42b-b4752f73er12"
  }
}
Complete conflict resolution guide

See the Conflict Resolution guide for detailed resolution steps for each conflict type, including code examples and best practices.

Best practices for pushing member data

  1. Store the accountId - Always save the accountId returned when creating a member. You'll need it for all future operations.

  2. Choose the right update method:

    • Use PATCH for incremental changes (recommended for most updates)
    • Use PUT only when you have the complete member record and need full replacement
    • PATCH is more efficient and safer for partial updates
  3. Validate before pushing - Check for duplicate emails and membershipIds in your MMS before sending to EGYM to prevent conflicts.

  4. Implement conflict handlers - Build automated conflict resolution into your sync process (see Conflict Resolution guide).

  5. Keep data synchronized - Push updates to EGYM whenever member information changes in your system.

  6. Log all operations - Track all PUSH operations and conflicts for monitoring and debugging.

What's next?

Now that you understand how to push member data to EGYM, you can explore additional operations:

  • Book products - Associate EGYM products and services with member accounts
  • Assign RFIDs - Link RFID cards for gym access control
  • Sync check-ins - Record member check-in and check-out events For complete details on all available endpoints and operations, see the API Reference.