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 Foundation
import ServiceStack

// @ApiResponse(Description="", ResponseType=typeof(AddNewUserResponse), StatusCode=200)
public class AddNewUserEndpoint : IAddNewUserEndpoint, IRestrictedApiRequest, Codable
{
    /**
    * IP address of the end user
    */
    // @ApiMember(Description="IP address of the end user", IsRequired=true, Name="X-Forwarded-For", ParameterType="header")
    public var xForwardedFor:String

    /**
    * Api Authentication Key
    */
    // @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
    public var apiKey:String

    /**
    * Member Id of the user buying the Package
    */
    // @ApiMember(Description="Member Id of the user buying the Package", IsRequired=true, ParameterType="query")
    public var memberId:Int

    /**
    * Id of the store for the user
    */
    // @ApiMember(Description="Id of the store for the user", IsRequired=true)
    public var storeId:Int?

    public var chainId:Int?
    /**
    * Package Id number of the package being purchased
    */
    // @ApiMember(Description="Package Id number of the package being purchased", IsRequired=true)
    public var packageId:Int

    /**
    * Installment Plan Id being purchased. If empty, the default package will be selected.
    */
    // @ApiMember(Description="Installment Plan Id being purchased. If empty, the default package will be selected.")
    public var installmentId:Int?

    /**
    * Date contract takes affect
    */
    // @ApiMember(Description="Date contract takes affect")
    public var startDate:Date?

    /**
    * Promo code to apply a discount.
    */
    // @ApiMember(Description="Promo code to apply a discount.")
    public var promoCode:String

    /**
    * Staff Id of salesperson who sold the agreement.
    */
    // @ApiMember(Description="Staff Id of salesperson who sold the agreement.")
    public var staffId:Int?

    public var restrictedId:Int?
    public var restrictedResourceType:RestrictedResourceType
    /**
    * First Name
    */
    // @ApiMember(Description="First Name", IsRequired=true)
    public var firstName:String

    /**
    * Last Name
    */
    // @ApiMember(Description="Last Name", IsRequired=true)
    public var lastName:String

    /**
    * Email Address
    */
    // @ApiMember(Description="Email Address", IsRequired=true)
    public var email:String

    /**
    * Gender
    */
    // @ApiMember(Description="Gender")
    public var gender:String

    /**
    * Address
    */
    // @ApiMember(Description="Address")
    public var address:String

    /**
    * City
    */
    // @ApiMember(Description="City")
    public var city:String

    /**
    * State
    */
    // @ApiMember(Description="State")
    public var state:String

    /**
    * Zip Code
    */
    // @ApiMember(Description="Zip Code")
    public var zip:String

    /**
    * Home phone
    */
    // @ApiMember(Description="Home phone")
    public var phone:String

    /**
    * Work phone
    */
    // @ApiMember(Description="Work phone")
    public var workPhone:String

    /**
    * Date of Birth
    */
    // @ApiMember(Description="Date of Birth")
    public var dateOfBirth:Date?

    /**
    * Cell phone
    */
    // @ApiMember(Description="Cell phone")
    public var cellPhone:String

    /**
    * Add an internal note for the new prospect
    */
    // @ApiMember(Description="Add an internal note for the new prospect")
    public var note:String

    /**
    * Unique Id for the user from your system. We store internally as ExternalUserId
    */
    // @ApiMember(Description="Unique Id for the user from your system. We store internally as ExternalUserId")
    public var externalId:String

    /**
    * Username should be between 4 and 255 characters long
    */
    // @ApiMember(Description="Username should be between 4 and 255 characters long")
    public var username:String

    /**
    * ReferralTypeId
    */
    // @ApiMember(Description="ReferralTypeId")
    public var referralTypeId:Int?

    /**
    * Emergency contact name
    */
    // @ApiMember(Description="Emergency contact name")
    public var emergencyContactName:String

    /**
    * Emergency contact phone number
    */
    // @ApiMember(Description="Emergency contact phone number")
    public var emergencyContactPhone:String

    /**
    * Emergency contact relationship
    */
    // @ApiMember(Description="Emergency contact relationship")
    public var emergencyContactType:String

    required public init(){}
}

public enum RestrictedResourceType : String, Codable
{
    case Store
    case Chain
    case User
    case Undefined
}

public class AddNewUserResponse : ApiResponse2Base
{
    public var incompleteAgreementToken:String
    public var memberId:Int?
    public var contractId:Int?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case incompleteAgreementToken
        case memberId
        case contractId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        incompleteAgreementToken = try container.decodeIfPresent(String.self, forKey: .incompleteAgreementToken)
        memberId = try container.decodeIfPresent(Int.self, forKey: .memberId)
        contractId = try container.decodeIfPresent(Int.self, forKey: .contractId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if incompleteAgreementToken != nil { try container.encode(incompleteAgreementToken, forKey: .incompleteAgreementToken) }
        if memberId != nil { try container.encode(memberId, forKey: .memberId) }
        if contractId != nil { try container.encode(contractId, forKey: .contractId) }
    }
}

public class ApiResponse2Base : Codable
{
    public var success:Bool
    public var message:String

    required public init(){}
}


Swift 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>