POST | /users/prospect | Create a Prospect |
---|
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
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiDtoBase:
api_key: Optional[str] = None
store_id: Optional[int] = None
chain_id: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateProspectRequestDto(ApiDtoBase):
first_name: Optional[str] = None
last_name: Optional[str] = None
address: Optional[str] = None
city: Optional[str] = None
state: Optional[str] = None
zip: Optional[str] = None
email: Optional[str] = None
gender: Optional[str] = None
add_package_id: Optional[int] = None
prospect_type_id: Optional[int] = None
referral_type_id: Optional[int] = None
send_email: bool = False
phone: Optional[str] = None
work_phone: Optional[str] = None
date_of_birth: Optional[datetime.datetime] = None
cell_phone: Optional[str] = None
coupon: Optional[str] = None
note: Optional[str] = None
email_template_id: Optional[int] = None
external_id: Optional[str] = None
referred_by: Optional[int] = None
assign_to_id: Optional[int] = None
assign_to_method: int = 0
contacted_how: Optional[int] = None
username: Optional[str] = None
emergency_contact_name: Optional[str] = None
emergency_contact_phone: Optional[str] = None
emergency_contact_type: Optional[str] = None
email_opt_out: bool = False
non_promotional_sms_opted_in: Optional[bool] = None
promotional_sms_opted_in: Optional[bool] = None
class RestrictedResourceType(str, Enum):
STORE = 'Store'
CHAIN = 'Chain'
USER = 'User'
UNDEFINED = 'Undefined'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateProspectRequest(CreateProspectRequestDto, IRestrictedApiRequest):
# @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
api_key: Optional[str] = None
"""
Api Key - grants access to resources
"""
# @ApiMember(DataType="integer", Description="ClubReady Club ID (StoreID internally)", IsRequired=true, Name="StoreId", ParameterType="query")
store_id: Optional[int] = None
"""
ClubReady Club ID (StoreID internally)
"""
# @ApiMember(DataType="string", Description="First Name", IsRequired=true, Name="FirstName", ParameterType="query")
first_name: Optional[str] = None
"""
First Name
"""
# @ApiMember(DataType="string", Description="Last Name", IsRequired=true, Name="LastName", ParameterType="query")
last_name: Optional[str] = None
"""
Last Name
"""
# @ApiMember(DataType="string", Description="Email Address", IsRequired=true, Name="Email", ParameterType="query")
email: Optional[str] = None
"""
Email Address
"""
# @ApiMember(DataType="string", Description="Gender (Format:'M'|'F')", Name="Gender", ParameterType="query")
gender: Optional[str] = None
"""
Gender (Format:'M'|'F')
"""
# @ApiMember(DataType="string", Description="Address", Name="Address", ParameterType="query")
address: Optional[str] = None
"""
Address
"""
# @ApiMember(DataType="string", Description="City", Name="City", ParameterType="query")
city: Optional[str] = None
"""
City
"""
# @ApiMember(DataType="string", Name="State", ParameterType="query")
state: Optional[str] = None
# @ApiMember(DataType="string", Name="Zip", ParameterType="query")
zip: Optional[str] = None
# @ApiMember(DataType="string", Description="Home phone", Name="Phone", ParameterType="query")
phone: Optional[str] = None
"""
Home phone
"""
# @ApiMember(DataType="string", Description="Work phone", Name="WorkPhone", ParameterType="query")
work_phone: Optional[str] = None
"""
Work phone
"""
# @ApiMember(DataType="date", Description="Date of Birth (Format:YYYY-MM-DD)", Name="DateOfBirth", ParameterType="query")
date_of_birth: Optional[datetime.datetime] = None
"""
Date of Birth (Format:YYYY-MM-DD)
"""
# @ApiMember(DataType="string", Description="Cell phone", Name="CellPhone", ParameterType="query")
cell_phone: Optional[str] = None
"""
Cell phone
"""
# @ApiMember(DataType="integer", Description="Specify a Package to apply to the new prospect", Name="AddPackageId", ParameterType="query")
add_package_id: Optional[int] = None
"""
Specify a Package to apply to the new prospect
"""
# @ApiMember(DataType="integer", Description="Specify a specific Prospect Type for the new prospect", Name="ProspectTypeId", ParameterType="query")
prospect_type_id: Optional[int] = None
"""
Specify a specific Prospect Type for the new prospect
"""
# @ApiMember(DataType="integer", Description="Specify a specific Referral Type for the new prospect", Name="ReferralTypeId", ParameterType="query")
referral_type_id: Optional[int] = None
"""
Specify a specific Referral Type for the new prospect
"""
# @ApiMember(DataType="boolean", Description="Send a Welcome email to the new prospect (Format:true|false)", IsRequired=true, Name="SendEmail", ParameterType="query")
send_email: bool = False
"""
Send a Welcome email to the new prospect (Format:true|false)
"""
# @ApiMember(DataType="integer", Description="Only used if SendEmail = True", Name="EmailTemplateId", ParameterType="query")
email_template_id: Optional[int] = None
"""
Only used if SendEmail = True
"""
# @ApiMember(DataType="string", Description="", Name="Coupon", ParameterType="query")
coupon: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="Add an internal note for the new prospect", Name="Note", ParameterType="query")
note: Optional[str] = None
"""
Add an internal note for the new prospect
"""
# @ApiMember(DataType="string", Description="Unique ID for the user from your system. We store internally as ExternalUserId", Name="ExternalId", ParameterType="query")
external_id: Optional[str] = None
"""
Unique ID for the user from your system. We store internally as ExternalUserId
"""
# @ApiMember(DataType="integer", Description="User ID of existing user who referred them.", Name="ReferredBy", ParameterType="query")
referred_by: Optional[int] = None
"""
User ID of existing user who referred them.
"""
# @ApiMember(DataType="integer", Description="ClubReady UserId of staff to assign new member to.", Name="AssignToId", ParameterType="query")
assign_to_id: Optional[int] = None
"""
ClubReady UserId of staff to assign new member to.
"""
# @ApiMember(DataType="integer", Description="Who should be assigned to this lead? 0 = Default lead assignments, 1 = When passing in a ReferredBy user, assign the new Lead to that referring user's Staff assignment.", Name="AssignToMethod", ParameterType="query")
assign_to_method: int = 0
"""
Who should be assigned to this lead? 0 = Default lead assignments, 1 = When passing in a ReferredBy user, assign the new Lead to that referring user's Staff assignment.
"""
# @ApiMember(DataType="string", Description="Username needs to be between 4 and 255 characters", Name="Username", ParameterType="query")
username: Optional[str] = None
"""
Username needs to be between 4 and 255 characters
"""
# @ApiMember(DataType="string", Description="Emergency contact name", Name="EmergencyContactName", ParameterType="query")
emergency_contact_name: Optional[str] = None
"""
Emergency contact name
"""
# @ApiMember(DataType="string", Description="Emergency contact phone number", Name="EmergencyContactPhone", ParameterType="query")
emergency_contact_phone: Optional[str] = None
"""
Emergency contact phone number
"""
# @ApiMember(DataType="string", Description="Emergency contact relationship", Name="EmergencyContactType", ParameterType="query")
emergency_contact_type: Optional[str] = None
"""
Emergency contact relationship
"""
# @ApiMember(DataType="boolean", Description="Set a prospect's email opt out status (Format:true|false)", Name="EmailOptOut", ParameterType="query")
email_opt_out: bool = False
"""
Set a prospect's email opt out status (Format:true|false)
"""
# @ApiMember(DataType="boolean", Description="Set a prospect's NonPromotionalSmsOptedIn status (Format:true|false)", Name="NonPromotionalSmsOptedIn", ParameterType="query")
non_promotional_sms_opted_in: Optional[bool] = None
"""
Set a prospect's NonPromotionalSmsOptedIn status (Format:true|false)
"""
# @ApiMember(DataType="boolean", Description="Set a prospect's NonPromotionalSmsOptedIn status (Format:true|false)", Name="PromotionalSmsOptedIn", ParameterType="query")
promotional_sms_opted_in: Optional[bool] = None
"""
Set a prospect's NonPromotionalSmsOptedIn status (Format:true|false)
"""
restricted_id: Optional[int] = None
restricted_resource_type: Optional[RestrictedResourceType] = None
Python CreateProspectRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /users/prospect HTTP/1.1
Host: clubready.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateProspectRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Members.Model">
<ApiKey xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ApiKey>
<ChainId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ChainId>
<StoreId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</StoreId>
<AddPackageId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</AddPackageId>
<Address xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Address>
<AssignToId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</AssignToId>
<AssignToMethod xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</AssignToMethod>
<CellPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</CellPhone>
<City xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</City>
<ContactedHow xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ContactedHow>
<Coupon xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Coupon>
<DateOfBirth xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0001-01-01T00:00:00</DateOfBirth>
<Email xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Email>
<EmailOptOut xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</EmailOptOut>
<EmailTemplateId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</EmailTemplateId>
<EmergencyContactName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</EmergencyContactName>
<EmergencyContactPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</EmergencyContactPhone>
<EmergencyContactType xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</EmergencyContactType>
<ExternalId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ExternalId>
<FirstName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</FirstName>
<Gender xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Gender>
<LastName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</LastName>
<NonPromotionalSmsOptedIn xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</NonPromotionalSmsOptedIn>
<Note xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Note>
<Phone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Phone>
<PromotionalSmsOptedIn xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</PromotionalSmsOptedIn>
<ProspectTypeId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ProspectTypeId>
<ReferralTypeId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ReferralTypeId>
<ReferredBy xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ReferredBy>
<SendEmail xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</SendEmail>
<State xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</State>
<Username xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Username>
<WorkPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</WorkPhone>
<Zip xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Zip>
</CreateProspectRequest>