| POST | /api/customerMaster/search/owner | Search customer master based on search parameters |
|---|
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
Object = TypeVar('Object')
class ORDER(str, Enum):
ASC = 'ASC'
DESC = 'DESC'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchCustomerMasterQuery(ISearchCustomerMaster):
continuation_token: Optional[str] = None
pay_by_entity_identification: Optional[str] = None
requested_page: int = 0
number_of_records_per_page: int = 0
order_by: Optional[str] = None
order: Optional[ORDER] = None
# @Api(Description="Customer Master")
# @ApiResponse(Description="Paged Customer Master data", IsDefaultResponse=true, ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchCustomerMaster:
"""
Customer Master
"""
# @ApiMember(Description="Search query", ParameterType="model")
query: Optional[SearchCustomerMasterQuery] = None
"""
Search query
"""
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PagedQueryResult(Generic[T]):
start_index: int = 0
end_index: int = 0
number_of_records_returned: int = 0
total_number_of_pages: int = 0
total_number_of_records: int = 0
results: List[ResultItem[ClaimMessage]] = field(default_factory=list)
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PagedQueryResponseWithToken(Generic[T], PagedQueryResult[ResultItem[InvoiceMessage]]):
continuation_token: Optional[str] = None
Python SearchCustomerMaster DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/customerMaster/search/owner HTTP/1.1
Host: stf-api-uat.data-xchange.co.za
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
query:
{
continuationToken: String,
payByEntityIdentification: String,
requestedPage: 0,
numberOfRecordsPerPage: 0,
orderBy: String,
order: ASC
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
continuationToken: String,
startIndex: 0,
endIndex: 0,
numberOfRecordsReturned: 0,
totalNumberOfPages: 0,
totalNumberOfRecords: 0,
results:
[
{
}
]
}