| POST | /customer/{brand}/export | Export Customer Data |
|---|
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 GetCustomerInterest:
# @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'
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetCustomerHobby:
# @ApiMember(Description="Hobby description")
hobby: Optional[str] = None
"""
Hobby description
"""
# @ApiMember(Description="SAP Hobby ID, e.g. 'ART'")
sap_hobby_id: Optional[str] = None
"""
SAP Hobby ID, e.g. 'ART'
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetCustomerProductCollection:
# @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'
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProductCategory:
# @ApiMember(Description="Brand Category ID")
brand_category_id: Optional[str] = None
"""
Brand Category ID
"""
# @ApiMember(Description="Grand Category ID", IsRequired=true)
grand_category_id: Optional[str] = None
"""
Grand Category ID
"""
# @ApiMember(Description="Master Category ID")
master_category_id: Optional[str] = None
"""
Master Category ID
"""
# @ApiMember(Description="Category ID")
category_id: Optional[str] = None
"""
Category ID
"""
# @ApiMember(Description="Sub Category ID")
sub_category_id: Optional[str] = None
"""
Sub Category ID
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchCustomer:
# @ApiMember(Description="Brand", IsRequired=true)
brand: Optional[str] = None
"""
Brand
"""
# @ApiMember(Description="POS Legacy", IsRequired=true)
pos_codes: Optional[List[str]] = None
"""
POS Legacy
"""
# @ApiMember(Description="Search key could be: 'Name', 'Email', 'Phone' without prefix, 'BoosterCustomerId' OR 'SapCRMId'")
search_key: Optional[str] = None
"""
Search key could be: 'Name', 'Email', 'Phone' without prefix, 'BoosterCustomerId' OR 'SapCRMId'
"""
# @ApiMember(Description="Search by phone number - exact match")
phone_number: Optional[str] = None
"""
Search by phone number - exact match
"""
# @ApiMember(Description="Search by email address - exact match")
email: Optional[str] = None
"""
Search by email address - exact match
"""
# @ApiMember(Description="Values can be 'it', 'en' etc.")
location_country_ids: Optional[List[str]] = None
"""
Values can be 'it', 'en' etc.
"""
# @ApiMember(Description="Client Spending From e.g. '100'")
client_spending_from: Optional[float] = None
"""
Client Spending From e.g. '100'
"""
# @ApiMember(Description="Client Spending To e.g. '50000'")
client_spending_to: Optional[float] = None
"""
Client Spending To e.g. '50000'
"""
# @ApiMember(Description="Customer Creation Date From e.g. '2022-01-01'")
creation_date_from: Optional[datetime.datetime] = None
"""
Customer Creation Date From e.g. '2022-01-01'
"""
# @ApiMember(Description="Customer Creation Date To e.g. '2023-11-01'")
creation_date_to: Optional[datetime.datetime] = None
"""
Customer Creation Date To e.g. '2023-11-01'
"""
# @ApiMember(Description="Transaction Date From e.g. '2022-01-01'")
transaction_date_from: Optional[datetime.datetime] = None
"""
Transaction Date From e.g. '2022-01-01'
"""
# @ApiMember(Description="Transaction Date To e.g. '2023-11-01'")
transaction_date_to: Optional[datetime.datetime] = None
"""
Transaction Date To e.g. '2023-11-01'
"""
# @ApiMember(Description="Values can be 'true' or 'false'")
can_be_contacted_by_maison: Optional[bool] = None
"""
Values can be 'true' or 'false'
"""
# @ApiMember(Description="Values can be 1 for 'January', 2 for 'February', 3 for 'March', 4 for 'April', 5 for 'May', 6 for 'June', 7 for 'July', 8 for 'August', 9 for 'September', 10 for 'October', 11 for 'November', 12 for 'December'")
birthdate_months: Optional[List[int]] = None
"""
Values can be 1 for 'January', 2 for 'February', 3 for 'March', 4 for 'April', 5 for 'May', 6 for 'June', 7 for 'July', 8 for 'August', 9 for 'September', 10 for 'October', 11 for 'November', 12 for 'December'
"""
# @ApiMember(Description="Customer interest filter")
interests: Optional[List[GetCustomerInterest]] = None
"""
Customer interest filter
"""
# @ApiMember(Description="Customer hobby filter")
hobbies: Optional[List[GetCustomerHobby]] = None
"""
Customer hobby filter
"""
# @ApiMember(Description="Customer product collection filter")
product_collections: Optional[List[GetCustomerProductCollection]] = None
"""
Customer product collection filter
"""
# @ApiMember(Description="Customer Status e.g. 'Prospect', 'Client'")
customer_status: Optional[List[str]] = None
"""
Customer Status e.g. 'Prospect', 'Client'
"""
# @ApiMember(Description="List of BoosterCustomerIds, e.g. 1234567,1231231,12323423")
booster_customer_ids: Optional[List[int]] = None
"""
List of BoosterCustomerIds, e.g. 1234567,1231231,12323423
"""
# @ApiMember(Description="Values can be 'true' or 'false'")
has_sap_crm_error: Optional[bool] = None
"""
Values can be 'true' or 'false'
"""
# @ApiMember(Description="Product Categories")
product_categories: Optional[List[ProductCategory]] = None
"""
Product Categories
"""
# @ApiMember(Description="Sale Reprentative Emails")
sale_representative_emails: Optional[List[str]] = None
"""
Sale Reprentative Emails
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ExportCustomerResponse:
# @ApiMember(Description="Unique Identifier of the Export Request created", IsRequired=true)
async_task_id: Optional[str] = None
"""
Unique Identifier of the Export Request created
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ExportCustomer(SearchCustomer):
# @ApiMember(Description="Export Request ID of the API Consumers", IsRequired=true)
download_request_id: Optional[str] = None
"""
Export Request ID of the API Consumers
"""
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 /customer/{brand}/export HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ExportCustomer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.CRM.ServiceModel">
<birthdateMonths xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:int>0</d2p1:int>
</birthdateMonths>
<boosterCustomerIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:int>0</d2p1:int>
</boosterCustomerIds>
<brand>String</brand>
<canBeContactedByMaison>false</canBeContactedByMaison>
<clientSpendingFrom>0</clientSpendingFrom>
<clientSpendingTo>0</clientSpendingTo>
<creationDateFrom>0001-01-01T00:00:00</creationDateFrom>
<creationDateTo>0001-01-01T00:00:00</creationDateTo>
<customerStatus xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</customerStatus>
<email>String</email>
<hasSapCrmError>false</hasSapCrmError>
<hobbies>
<GetCustomerHobby>
<hobby>String</hobby>
<sapHobbyId>String</sapHobbyId>
</GetCustomerHobby>
</hobbies>
<interests>
<GetCustomerInterest>
<interest>String</interest>
<sapInterestId>String</sapInterestId>
</GetCustomerInterest>
</interests>
<locationCountryIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</locationCountryIds>
<phoneNumber>String</phoneNumber>
<posCodes xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</posCodes>
<productCategories xmlns:d2p1="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.Common.ServiceModel">
<d2p1:ProductCategory>
<d2p1:brandCategoryId>String</d2p1:brandCategoryId>
<d2p1:categoryId>String</d2p1:categoryId>
<d2p1:grandCategoryId>String</d2p1:grandCategoryId>
<d2p1:masterCategoryId>String</d2p1:masterCategoryId>
<d2p1:subCategoryId>String</d2p1:subCategoryId>
</d2p1:ProductCategory>
</productCategories>
<productCollections>
<GetCustomerProductCollection>
<productCollection>String</productCollection>
<sapProductCollectionId>String</sapProductCollectionId>
</GetCustomerProductCollection>
</productCollections>
<saleRepresentativeEmails xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</saleRepresentativeEmails>
<searchKey>String</searchKey>
<transactionDateFrom>0001-01-01T00:00:00</transactionDateFrom>
<transactionDateTo>0001-01-01T00:00:00</transactionDateTo>
<downloadRequestId>String</downloadRequestId>
</ExportCustomer>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ExportCustomerResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.CRM.ServiceModel"> <asyncTaskId>00000000-0000-0000-0000-000000000000</asyncTaskId> </ExportCustomerResponse>