| GET | /customer/{brand}/slim | Get customers list | Get slim list of customers paginated and sorted |
|---|
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 GetCustomerPaginatedElement:
# @ApiMember(Description="Booster Customer Id", IsRequired=true)
booster_customer_id: int = 0
"""
Booster Customer Id
"""
# @ApiMember(Description="First name", IsRequired=true)
first_name: Optional[str] = None
"""
First name
"""
# @ApiMember(Description="Middle name", IsRequired=true)
middle_name: Optional[str] = None
"""
Middle name
"""
# @ApiMember(Description="Last name", IsRequired=true)
last_name: Optional[str] = None
"""
Last name
"""
# @ApiMember(Description="First name Not Latin", IsRequired=true)
first_name_not_latin: Optional[str] = None
"""
First name Not Latin
"""
# @ApiMember(Description="Last name Not Latin", IsRequired=true)
last_name_not_latin: Optional[str] = None
"""
Last name Not Latin
"""
# @ApiMember(Description="Customer phone", IsRequired=true)
phone: Optional[str] = None
"""
Customer phone
"""
# @ApiMember(Description="Phone Country Prefix", IsRequired=true)
country_prefix: Optional[str] = None
"""
Phone Country Prefix
"""
# @ApiMember(Description="Customer email", IsRequired=true)
email: Optional[str] = None
"""
Customer email
"""
# @ApiMember(Description="Data Sharing Consent", IsRequired=true)
data_sharing_consent: Optional[bool] = None
"""
Data Sharing Consent
"""
# @ApiMember(Description="Sellout Transaction Count", IsRequired=true)
sellout_transaction_count: int = 0
"""
Sellout Transaction Count
"""
# @ApiMember(Description="Elevate Customer ID")
elevate_customer_id: Optional[str] = None
"""
Elevate Customer ID
"""
# @ApiMember(Description="Elevate Consent Status")
elevate_consent_status: Optional[str] = None
"""
Elevate Consent Status
"""
# @ApiMember(Description="Customer Country Id")
country_id: Optional[str] = None
"""
Customer Country Id
"""
# @ApiMember(Description="Registration date")
registration_date: Optional[datetime.datetime] = None
"""
Registration date
"""
# @ApiMember(Description="Sap Crm Error Message")
sap_crm_error_message: Optional[str] = None
"""
Sap Crm Error Message
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetCustomerPaginatedResponse:
# @ApiMember(Description="Total Pages", IsRequired=true)
total_pages: int = 0
"""
Total Pages
"""
# @ApiMember(Description="Total Results", IsRequired=true)
total_results: int = 0
"""
Total Results
"""
# @ApiMember(Description="Index of the result set returned", IsRequired=true)
page: int = 0
"""
Index of the result set returned
"""
# @ApiMember(Description="Size of the result set returned", IsRequired=true)
items: int = 0
"""
Size of the result set returned
"""
# @ApiMember(Description="List of customers", IsRequired=true)
elements: Optional[List[GetCustomerPaginatedElement]] = None
"""
List of customers
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetCustomerPaginated(SearchCustomer, IPagedRequest):
# @ApiMember(Description="Index of the result set returned")
page: int = 0
"""
Index of the result set returned
"""
# @ApiMember(Description="Size of the result set returned")
items: int = 0
"""
Size of the result set returned
"""
# @ApiMember(Description="Omit precise record count - save on performance")
no_count: bool = False
"""
Omit precise record count - save on performance
"""
# @ApiMember(Description="Values can be 'NameDESC', 'NameASC', 'RegASC', 'RegDESC'")
sort_by: Optional[str] = None
"""
Values can be 'NameDESC', 'NameASC', 'RegASC', 'RegDESC'
"""
Python GetCustomerPaginated DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /customer/{brand}/slim HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"totalPages":0,"totalResults":0,"page":0,"items":0}