PUT | /customer/{boosterCustomerId} | Update customer | Update CRM customer |
---|
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 Email:
# @ApiMember(Description="Email", IsRequired=true)
email: Optional[str] = None
"""
Email
"""
# @ApiMember(Description="Main email", IsRequired=true)
is_main_email: bool = False
"""
Main email
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Phone:
# @ApiMember(Description="Phone e.g. cn: 13888889999, jp: 352858088, kr: 023123456", IsRequired=true)
phone: Optional[str] = None
"""
Phone e.g. cn: 13888889999, jp: 352858088, kr: 023123456
"""
# @ApiMember(Description="Prefix Country Id e.g. it, fr, az", IsRequired=true)
country_prefix: Optional[str] = None
"""
Prefix Country Id e.g. it, fr, az
"""
# @ApiMember(Description="Phone type e.g. 'Home', 'Mobile', 'Work', 'Other', 'Secondary Address'")
phone_type: Optional[str] = None
"""
Phone type e.g. 'Home', 'Mobile', 'Work', 'Other', 'Secondary Address'
"""
# @ApiMember(Description="Main Phone", IsRequired=true)
is_main_phone: bool = False
"""
Main Phone
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Address:
# @ApiMember(Description="Address type e.g. Home, Office, Shipping", IsRequired=true)
address_type: Optional[str] = None
"""
Address type e.g. Home, Office, Shipping
"""
# @ApiMember(Description="Country Id e.g. it, cn, az, gb, de", IsRequired=true)
country_id: Optional[str] = None
"""
Country Id e.g. it, cn, az, gb, de
"""
# @ApiMember(Description="House Number")
house_number: Optional[str] = None
"""
House Number
"""
# @ApiMember(Description="Region/State")
state_id: Optional[str] = None
"""
Region/State
"""
# @ApiMember(Description="City Name")
city: Optional[str] = None
"""
City Name
"""
# @ApiMember(Description="Postal Code")
zip_code: Optional[str] = None
"""
Postal Code
"""
# @ApiMember(Description="Street Name and Number")
street: Optional[str] = None
"""
Street Name and Number
"""
# @ApiMember(Description="Street 2")
street2: Optional[str] = None
"""
Street 2
"""
# @ApiMember(Description="Street 3")
street3: Optional[str] = None
"""
Street 3
"""
# @ApiMember(Description="Street 4")
street4: Optional[str] = None
"""
Street 4
"""
# @ApiMember(Description="Street 5")
street5: Optional[str] = None
"""
Street 5
"""
# @ApiMember(Description="Main Address", IsRequired=true)
is_main_address: bool = False
"""
Main Address
"""
# @ApiMember(Description="Post Office Box")
po_box: Optional[str] = None
"""
Post Office Box
"""
# @ApiMember(Description="Additional Information")
additional_information: Optional[str] = None
"""
Additional Information
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Event:
# @ApiMember(Description="Event type e.g. 'Birthday', 'Wedding', 'Anniversary', 'Barmitza', 'Other'", IsRequired=true)
event_type: Optional[str] = None
"""
Event type e.g. 'Birthday', 'Wedding', 'Anniversary', 'Barmitza', 'Other'
"""
# @ApiMember(Description="Event date e.g. '2021-01-20'", IsRequired=true)
event_date: datetime.datetime = datetime.datetime(1, 1, 1)
"""
Event date e.g. '2021-01-20'
"""
# @ApiMember(Description="Event notes")
event_notes: Optional[str] = None
"""
Event notes
"""
# @ApiMember(Description="Event other name")
event_other_name: Optional[str] = None
"""
Event other name
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Interest:
# @ApiMember(Description="Interest description", IsRequired=true)
interest: Optional[str] = None
"""
Interest description
"""
# @ApiMember(Description="SAP Interest ID, e.g. 'CA-1'", IsRequired=true)
sap_interest_id: Optional[str] = None
"""
SAP Interest ID, e.g. 'CA-1'
"""
# @ApiMember(Description="Interest description translation")
translation: Optional[str] = None
"""
Interest description translation
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Hobby:
# @ApiMember(Description="Hobby description", IsRequired=true)
hobby: Optional[str] = None
"""
Hobby description
"""
# @ApiMember(Description="SAP Hobby ID, e.g. 'ART'", IsRequired=true)
sap_hobby_id: Optional[str] = None
"""
SAP Hobby ID, e.g. 'ART'
"""
# @ApiMember(Description="Hobby description translation")
translation: Optional[str] = None
"""
Hobby description translation
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProductCollection:
# @ApiMember(Description="Product Collection description", IsRequired=true)
product_collection: Optional[str] = None
"""
Product Collection description
"""
# @ApiMember(Description="SAP ProductCollection ID, e.g. 'CA-1'", IsRequired=true)
sap_product_collection_id: Optional[str] = None
"""
SAP ProductCollection ID, e.g. 'CA-1'
"""
# @ApiMember(Description="Product Collection description translation", IsRequired=true)
translation: Optional[str] = None
"""
Product Collection description translation
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Customer:
# @ApiMember(Description="Title e.g. 'Mr & Mrs', 'Mr.', 'Mrs.', 'Sama', 'Captain' - Mandatory only when customer type is 'PRIVATE'")
title: Optional[str] = None
"""
Title e.g. 'Mr & Mrs', 'Mr.', 'Mrs.', 'Sama', 'Captain' - Mandatory only when customer type is 'PRIVATE'
"""
# @ApiMember(Description="First Name")
first_name: Optional[str] = None
"""
First Name
"""
# @ApiMember(Description="Last Name - Mandatory only when customer type is 'PRIVATE'")
last_name: Optional[str] = None
"""
Last Name - Mandatory only when customer type is 'PRIVATE'
"""
# @ApiMember(Description="First Name Not Latin")
first_name_not_latin: Optional[str] = None
"""
First Name Not Latin
"""
# @ApiMember(Description="Last Name Not Latin")
last_name_not_latin: Optional[str] = None
"""
Last Name Not Latin
"""
# @ApiMember(Description="Middle Name")
middle_name: Optional[str] = None
"""
Middle Name
"""
# @ApiMember(Description="Name Suffix")
name_suffix: Optional[str] = None
"""
Name Suffix
"""
# @ApiMember(Description="Can be Contacted by Maison e.g. true or false", IsRequired=true)
can_be_contacted_by_maison: bool = False
"""
Can be Contacted by Maison e.g. true or false
"""
# @ApiMember(Description="Customer Type e.g. 'PRIVATE' or 'COMPANY'", IsRequired=true)
client_type: Optional[str] = None
"""
Customer Type e.g. 'PRIVATE' or 'COMPANY'
"""
# @ApiMember(Description="Company Name - Mandatory only when customer type is 'COMPANY'")
company_name: Optional[str] = None
"""
Company Name - Mandatory only when customer type is 'COMPANY'
"""
# @ApiMember(Description="Language Id e.g. ita, chi, aze, eng, ger - Mandatory only when customer type is 'PRIVATE'")
language_id: Optional[str] = None
"""
Language Id e.g. ita, chi, aze, eng, ger - Mandatory only when customer type is 'PRIVATE'
"""
# @ApiMember(Description="Gender e.g. M, F - Mandatory only when customer type is 'PRIVATE'")
gender: Optional[str] = None
"""
Gender e.g. M, F - Mandatory only when customer type is 'PRIVATE'
"""
# @ApiMember(Description="Country Id e.g. it, cn, az, gb, de", IsRequired=true)
country_id: Optional[str] = None
"""
Country Id e.g. it, cn, az, gb, de
"""
# @ApiMember(Description="Birth Date e.g. '2020-12-30'")
birth_date: Optional[datetime.datetime] = None
"""
Birth Date e.g. '2020-12-30'
"""
# @ApiMember(Description="Customer reference")
customer_reference: Optional[str] = None
"""
Customer reference
"""
# @ApiMember(Description="POS Code e.g. ES100:102048", IsRequired=true)
pos_code: Optional[str] = None
"""
POS Code e.g. ES100:102048
"""
# @ApiMember(Description="Brand e.g. CAR, MTB", IsRequired=true)
brand: Optional[str] = None
"""
Brand e.g. CAR, MTB
"""
# @ApiMember(Description="Wedding Date, e.g. '2020-01-18'")
wedding_date: Optional[datetime.datetime] = None
"""
Wedding Date, e.g. '2020-01-18'
"""
# @ApiMember(Description="Preferred Contact Method e.g. 'Fax', 'Tel', 'EMail', 'Mail', 'Survey'")
preferred_contact_method: Optional[str] = None
"""
Preferred Contact Method e.g. 'Fax', 'Tel', 'EMail', 'Mail', 'Survey'
"""
# @ApiMember(Description="Provide 'true' if you want to be contacted by email. Leave empty or 'false' if you do not.")
contact_by_email_flag: bool = False
"""
Provide 'true' if you want to be contacted by email. Leave empty or 'false' if you do not.
"""
# @ApiMember(Description="Provide 'true' if you want to be contacted by mail. Leave empty or 'false' if you do not.")
contact_by_mail_flag: bool = False
"""
Provide 'true' if you want to be contacted by mail. Leave empty or 'false' if you do not.
"""
# @ApiMember(Description="Provide 'true' if you want to be contacted by phone. Leave empty or 'false' if you do not.")
contact_by_phone_flag: bool = False
"""
Provide 'true' if you want to be contacted by phone. Leave empty or 'false' if you do not.
"""
# @ApiMember(Description="Provide 'true' if you want to be contacted by SMS. Leave empty or 'false' if you do not.")
contact_by_s_m_s_flag: bool = False
"""
Provide 'true' if you want to be contacted by SMS. Leave empty or 'false' if you do not.
"""
# @ApiMember(Description="Provide 'true' if you want to be contacted by social media. Leave empty or 'false' if you do not.")
contact_by_social_media_flag: bool = False
"""
Provide 'true' if you want to be contacted by social media. Leave empty or 'false' if you do not.
"""
# @ApiMember(Description="Sale Representative Email e.g. rauf.aliyev@richemont.com")
sale_representative_email: Optional[str] = None
"""
Sale Representative Email e.g. rauf.aliyev@richemont.com
"""
# @ApiMember(Description="Consent for allowing Cross Border Data Transfer")
allow_store_data_abroad: Optional[bool] = None
"""
Consent for allowing Cross Border Data Transfer
"""
# @ApiMember(Description="Consent for allowing Cross Border Data Transfer For TimeVallée")
tv_allow_store_data_abroad: Optional[bool] = None
"""
Consent for allowing Cross Border Data Transfer For TimeVallée
"""
# @ApiMember(Description="Customer emails")
emails: Optional[List[Email]] = None
"""
Customer emails
"""
# @ApiMember(Description="Customer phones")
phones: Optional[List[Phone]] = None
"""
Customer phones
"""
# @ApiMember(Description="Customer addresses")
addresses: Optional[List[Address]] = None
"""
Customer addresses
"""
# @ApiMember(Description="Customer events")
events: Optional[List[Event]] = None
"""
Customer events
"""
# @ApiMember(Description="Customer interests")
interests: Optional[List[Interest]] = None
"""
Customer interests
"""
# @ApiMember(Description="Customer hobbies")
hobbies: Optional[List[Hobby]] = None
"""
Customer hobbies
"""
# @ApiMember(Description="Customer product collections")
product_collections: Optional[List[ProductCollection]] = None
"""
Customer product collections
"""
# @ApiMember(Description="Provide 'true' if you allow data sharing consent. Leave empty or 'false' if you do not.")
data_sharing_consent: Optional[bool] = None
"""
Provide 'true' if you allow data sharing consent. Leave empty or 'false' if you do not.
"""
# @ApiMember(Description="Notes")
notes: Optional[str] = None
"""
Notes
"""
# @ApiMember(Description="Reference Sale Representative Email")
reference_sale_representative_email: Optional[str] = None
"""
Reference Sale Representative Email
"""
# @ApiMember(Description="Registration Date")
registration_date: Optional[datetime.datetime] = None
"""
Registration Date
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UpdateCustomer(Customer):
# @ApiMember(Description="Booster customer Id")
booster_customer_id: int = 0
"""
Booster customer Id
"""
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.
PUT /customer/{boosterCustomerId} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateCustomer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.CRM.ServiceModel">
<addresses>
<Address>
<additionalInformation>String</additionalInformation>
<addressType>String</addressType>
<city>String</city>
<countryId>String</countryId>
<houseNumber>String</houseNumber>
<isMainAddress>false</isMainAddress>
<poBox>String</poBox>
<stateId>String</stateId>
<street>String</street>
<street2>String</street2>
<street3>String</street3>
<street4>String</street4>
<street5>String</street5>
<zipCode>String</zipCode>
</Address>
</addresses>
<allowStoreDataAbroad>false</allowStoreDataAbroad>
<birthDate>0001-01-01T00:00:00</birthDate>
<brand>String</brand>
<canBeContactedByMaison>false</canBeContactedByMaison>
<clientType>String</clientType>
<companyName>String</companyName>
<contactByEmailFlag>false</contactByEmailFlag>
<contactByMailFlag>false</contactByMailFlag>
<contactByPhoneFlag>false</contactByPhoneFlag>
<contactBySMSFlag>false</contactBySMSFlag>
<contactBySocialMediaFlag>false</contactBySocialMediaFlag>
<countryId>String</countryId>
<customerReference>String</customerReference>
<dataSharingConsent>false</dataSharingConsent>
<emails>
<Email>
<email>String</email>
<isMainEmail>false</isMainEmail>
</Email>
</emails>
<events>
<Event>
<eventDate>0001-01-01T00:00:00</eventDate>
<eventNotes>String</eventNotes>
<eventOtherName>String</eventOtherName>
<eventType>String</eventType>
</Event>
</events>
<firstName>String</firstName>
<firstNameNotLatin>String</firstNameNotLatin>
<gender>String</gender>
<hobbies>
<Hobby>
<hobby>String</hobby>
<sapHobbyId>String</sapHobbyId>
<translation>String</translation>
</Hobby>
</hobbies>
<interests>
<Interest>
<interest>String</interest>
<sapInterestId>String</sapInterestId>
<translation>String</translation>
</Interest>
</interests>
<languageId>String</languageId>
<lastName>String</lastName>
<lastNameNotLatin>String</lastNameNotLatin>
<middleName>String</middleName>
<nameSuffix>String</nameSuffix>
<notes>String</notes>
<phones>
<Phone>
<countryPrefix>String</countryPrefix>
<isMainPhone>false</isMainPhone>
<phone>String</phone>
<phoneType>String</phoneType>
</Phone>
</phones>
<posCode>String</posCode>
<preferredContactMethod>String</preferredContactMethod>
<productCollections>
<ProductCollection>
<productCollection>String</productCollection>
<sapProductCollectionId>String</sapProductCollectionId>
<translation>String</translation>
</ProductCollection>
</productCollections>
<referenceSaleRepresentativeEmail>String</referenceSaleRepresentativeEmail>
<registrationDate>0001-01-01T00:00:00</registrationDate>
<saleRepresentativeEmail>String</saleRepresentativeEmail>
<title>String</title>
<tvAllowStoreDataAbroad>false</tvAllowStoreDataAbroad>
<weddingDate>0001-01-01T00:00:00</weddingDate>
<boosterCustomerId>0</boosterCustomerId>
</UpdateCustomer>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />