ClubReady Api

<back to all web services

AddNewUserEndpoint

The following routes are available for this service:
POST/sales/agreement/addNewUserSet up a package that will be sold to an existing userSet up a package that will be sold to an existing user. The header `X-Forwarded-For` is required and should be set to the IP address of the end user.
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


class RestrictedResourceType(str, Enum):
    STORE = 'Store'
    CHAIN = 'Chain'
    USER = 'User'
    UNDEFINED = 'Undefined'


# @ApiResponse(Description="", ResponseType=typeof(AddNewUserResponse), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddNewUserEndpoint(IAddNewUserEndpoint, IRestrictedApiRequest):
    # @ApiMember(Description="IP address of the end user", IsRequired=true, Name="X-Forwarded-For", ParameterType="header")
    x_forwarded_for: Optional[str] = None
    """
    IP address of the end user
    """


    # @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
    api_key: Optional[str] = None
    """
    Api Authentication Key
    """


    # @ApiMember(Description="Member Id of the user buying the Package", IsRequired=true, ParameterType="query")
    member_id: int = 0
    """
    Member Id of the user buying the Package
    """


    # @ApiMember(Description="Id of the store for the user", IsRequired=true)
    store_id: Optional[int] = None
    """
    Id of the store for the user
    """


    chain_id: Optional[int] = None
    # @ApiMember(Description="Package Id number of the package being purchased", IsRequired=true)
    package_id: int = 0
    """
    Package Id number of the package being purchased
    """


    # @ApiMember(Description="Installment Plan Id being purchased. If empty, the default package will be selected.")
    installment_id: Optional[int] = None
    """
    Installment Plan Id being purchased. If empty, the default package will be selected.
    """


    # @ApiMember(Description="Date contract takes affect")
    start_date: Optional[datetime.datetime] = None
    """
    Date contract takes affect
    """


    # @ApiMember(Description="Promo code to apply a discount.")
    promo_code: Optional[str] = None
    """
    Promo code to apply a discount.
    """


    # @ApiMember(Description="Staff Id of salesperson who sold the agreement.")
    staff_id: Optional[int] = None
    """
    Staff Id of salesperson who sold the agreement.
    """


    restricted_id: Optional[int] = None
    restricted_resource_type: Optional[RestrictedResourceType] = None
    # @ApiMember(Description="First Name", IsRequired=true)
    first_name: Optional[str] = None
    """
    First Name
    """


    # @ApiMember(Description="Last Name", IsRequired=true)
    last_name: Optional[str] = None
    """
    Last Name
    """


    # @ApiMember(Description="Email Address", IsRequired=true)
    email: Optional[str] = None
    """
    Email Address
    """


    # @ApiMember(Description="Gender")
    gender: Optional[str] = None
    """
    Gender
    """


    # @ApiMember(Description="Address")
    address: Optional[str] = None
    """
    Address
    """


    # @ApiMember(Description="City")
    city: Optional[str] = None
    """
    City
    """


    # @ApiMember(Description="State")
    state: Optional[str] = None
    """
    State
    """


    # @ApiMember(Description="Zip Code")
    zip: Optional[str] = None
    """
    Zip Code
    """


    # @ApiMember(Description="Home phone")
    phone: Optional[str] = None
    """
    Home phone
    """


    # @ApiMember(Description="Work phone")
    work_phone: Optional[str] = None
    """
    Work phone
    """


    # @ApiMember(Description="Date of Birth")
    date_of_birth: Optional[datetime.datetime] = None
    """
    Date of Birth
    """


    # @ApiMember(Description="Cell phone")
    cell_phone: Optional[str] = None
    """
    Cell phone
    """


    # @ApiMember(Description="Add an internal note for the new prospect")
    note: Optional[str] = None
    """
    Add an internal note for the new prospect
    """


    # @ApiMember(Description="Unique Id for the user from your system. We store internally as ExternalUserId")
    external_id: Optional[str] = None
    """
    Unique Id for the user from your system. We store internally as ExternalUserId
    """


    # @ApiMember(Description="Username should be between 4 and 255 characters long")
    username: Optional[str] = None
    """
    Username should be between 4 and 255 characters long
    """


    # @ApiMember(Description="ReferralTypeId")
    referral_type_id: Optional[int] = None
    """
    ReferralTypeId
    """


    # @ApiMember(Description="Emergency contact name")
    emergency_contact_name: Optional[str] = None
    """
    Emergency contact name
    """


    # @ApiMember(Description="Emergency contact phone number")
    emergency_contact_phone: Optional[str] = None
    """
    Emergency contact phone number
    """


    # @ApiMember(Description="Emergency contact relationship")
    emergency_contact_type: Optional[str] = None
    """
    Emergency contact relationship
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiResponse2Base:
    success: bool = False
    message: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddNewUserResponse(ApiResponse2Base):
    incomplete_agreement_token: Optional[str] = None
    member_id: Optional[int] = None
    contract_id: Optional[int] = None

Python AddNewUserEndpoint DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /sales/agreement/addNewUser HTTP/1.1 
Host: www.clubready.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<AddNewUserEndpoint xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Sales.Agreement">
  <Address>String</Address>
  <ApiKey>String</ApiKey>
  <CellPhone>String</CellPhone>
  <ChainId>0</ChainId>
  <City>String</City>
  <DateOfBirth>0001-01-01T00:00:00</DateOfBirth>
  <Email>String</Email>
  <EmergencyContactName>String</EmergencyContactName>
  <EmergencyContactPhone>String</EmergencyContactPhone>
  <EmergencyContactType>String</EmergencyContactType>
  <ExternalId>String</ExternalId>
  <FirstName>String</FirstName>
  <Gender>String</Gender>
  <InstallmentId>0</InstallmentId>
  <LastName>String</LastName>
  <MemberId>0</MemberId>
  <Note>String</Note>
  <PackageId>0</PackageId>
  <Phone>String</Phone>
  <PromoCode>String</PromoCode>
  <ReferralTypeId>0</ReferralTypeId>
  <StaffId>0</StaffId>
  <StartDate>0001-01-01T00:00:00</StartDate>
  <State>String</State>
  <StoreId>0</StoreId>
  <Username>String</Username>
  <WorkPhone>String</WorkPhone>
  <XForwardedFor>String</XForwardedFor>
  <Zip>String</Zip>
</AddNewUserEndpoint>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<AddNewUserResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Sales.Agreement">
  <message xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api">String</message>
  <success xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api">false</success>
  <contractId>0</contractId>
  <incompleteAgreementToken>String</incompleteAgreementToken>
  <memberId>0</memberId>
</AddNewUserResponse>