POST, GET | /api/SearchInventory |
---|
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 BaseRequest:
# @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
api_key: Optional[str] = None
"""
This is your AIM API Key provided by Tri-Tech
"""
# @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
o_auth_token: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseSecureRequest(BaseRequest):
# @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header")
token: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header")
device_id: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header")
app_id: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponseResult:
# @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
status_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
login: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
error_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
error_display_text: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
error_message: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
domain_name: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
ip_address: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponse:
# @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
status: Optional[BaseResponseResult] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BindableObject:
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchInventoryResultSet(BindableObject, IAIMInventoryRecord):
pk: int = 0
description: Optional[str] = None
inventory_type: Optional[str] = None
manufacturer: Optional[str] = None
model: Optional[str] = None
category: Optional[Decimal] = None
category_description: Optional[str] = None
sub_category: Optional[Decimal] = None
sub_category_description: Optional[str] = None
selection_code: Optional[str] = None
selection_code_description: Optional[str] = None
sku: Optional[str] = None
mpn: Optional[str] = None
discontinued: Optional[bool] = None
attribute1: Optional[str] = None
attribute2: Optional[str] = None
attribute3: Optional[str] = None
attribute4: Optional[str] = None
attribute5: Optional[str] = None
attribute6: Optional[str] = None
attribute7: Optional[str] = None
attribute8: Optional[str] = None
attribute9: Optional[str] = None
attribute10: Optional[str] = None
attribute11: Optional[str] = None
attribute12: Optional[str] = None
attribute13: Optional[str] = None
attribute14: Optional[str] = None
attribute15: Optional[str] = None
attribute16: Optional[str] = None
attribute17: Optional[str] = None
attribute18: Optional[str] = None
attribute19: Optional[str] = None
attribute20: Optional[str] = None
computer_quantity: Decimal = decimal.Decimal(0)
our_price: Decimal = decimal.Decimal(0)
retail_price: Decimal = decimal.Decimal(0)
activee_price: Decimal = decimal.Decimal(0)
price_a: Decimal = decimal.Decimal(0)
price_b: Decimal = decimal.Decimal(0)
price_c: Decimal = decimal.Decimal(0)
min_price: Decimal = decimal.Decimal(0)
available_quantity: Decimal = decimal.Decimal(0)
is_media: bool = False
is_package: bool = False
has_image: bool = False
search_term: Optional[str] = None
keywords: Optional[str] = None
keywords_origin: Optional[str] = None
deleted: bool = False
time_stamp: datetime.datetime = datetime.datetime(1, 1, 1)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ImageInfo:
url: Optional[str] = None
image_stream: Optional[str] = None
image_size: Optional[str] = None
error_message: Optional[str] = None
uri_pk: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailAttribute:
name: Optional[str] = None
value: Optional[str] = None
priority: int = 0
# @ApiMember(DataType="int", Description="1 is 'Don't Send to Web', 2 is 'Guided Navigation'", Name="WebType", ParameterType="query")
web_type: int = 0
"""
1 is 'Don't Send to Web', 2 is 'Guided Navigation'
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LocationInfo:
id: int = 0
desc: Optional[str] = None
short_desc: Optional[str] = None
region: Optional[str] = None
latitude: Decimal = decimal.Decimal(0)
longitude: Decimal = decimal.Decimal(0)
in_store_pickup: Optional[str] = None
active: bool = False
cash_sale_acct: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailBySerial:
sas_pk: int = 0
serial: Optional[str] = None
retail: Decimal = decimal.Decimal(0)
our_price: Decimal = decimal.Decimal(0)
sale_price: Optional[Decimal] = None
status: Optional[str] = None
sale_info: Optional[str] = None
price_a: Decimal = decimal.Decimal(0)
price_b: Decimal = decimal.Decimal(0)
price_c: Decimal = decimal.Decimal(0)
min_price: Decimal = decimal.Decimal(0)
active_e_price: Decimal = decimal.Decimal(0)
allow_price_change: bool = False
cost: Optional[Decimal] = None
weighted_cost: Optional[Decimal] = None
notes: Optional[str] = None
attributes: Optional[List[InventoryDetailAttribute]] = None
images: Optional[List[ImageInfo]] = None
has_images: bool = False
is_activee_holdback: bool = False
customer_acct: Optional[int] = None
available_for_s_t_r: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailSubstitute:
model: Optional[str] = None
sku: Optional[str] = None
mfg: Optional[str] = None
description: Optional[str] = None
price: Decimal = decimal.Decimal(0)
available_qty: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailByLocation:
saq_pk: int = 0
location_info: Optional[LocationInfo] = None
serials: Optional[List[InventoryDetailBySerial]] = None
substitutes: Optional[List[InventoryDetailSubstitute]] = None
retail: Decimal = decimal.Decimal(0)
our_price: Decimal = decimal.Decimal(0)
sale_price: Optional[Decimal] = None
sale_info: Optional[str] = None
price_a: Decimal = decimal.Decimal(0)
price_b: Decimal = decimal.Decimal(0)
price_c: Decimal = decimal.Decimal(0)
min_price: Decimal = decimal.Decimal(0)
active_e_price: Decimal = decimal.Decimal(0)
customer_price: Decimal = decimal.Decimal(0)
allow_price_change: bool = False
qty: Decimal = decimal.Decimal(0)
qty_avail: Decimal = decimal.Decimal(0)
activee_holdback_qty: Decimal = decimal.Decimal(0)
reorder_min: int = 0
reorder_max: int = 0
average_cost: Optional[Decimal] = None
weighted_cost: Optional[Decimal] = None
locator: Optional[str] = None
selection_code: Optional[str] = None
selection_code_description: Optional[str] = None
spiff: Decimal = decimal.Decimal(0)
current_spot_check_qty: Optional[Decimal] = None
qty_out: Decimal = decimal.Decimal(0)
qty_on_order: Decimal = decimal.Decimal(0)
available_for_s_t_r: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailByVariant:
sku_pk: int = 0
sku: Optional[str] = None
vendor_cost: Optional[Decimal] = None
vendor_name: Optional[str] = None
attributes: Optional[List[InventoryDetailAttribute]] = None
location_details: Optional[List[InventoryDetailByLocation]] = None
images: Optional[List[ImageInfo]] = None
has_images: bool = False
barcodes: Optional[List[str]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddOnDetail:
sad_pk: int = 0
sku_pk: int = 0
cat_pk: int = 0
sub_pk: int = 0
item: Optional[str] = None
description: Optional[str] = None
price: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ActiveEInfo:
dimension: Optional[str] = None
web_description: Optional[str] = None
summary: Optional[str] = None
se_title: Optional[str] = None
se_description: Optional[str] = None
se_keywords: Optional[str] = None
se_alt_text: Optional[str] = None
se_html_free_text: Optional[str] = None
unpublished: bool = False
free_shipping: bool = False
is_featured: bool = False
web_category_ids: Optional[List[int]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetail:
sad_pk: int = 0
inv_type: Optional[str] = None
model: Optional[str] = None
description: Optional[str] = None
mfg: Optional[str] = None
category: int = 0
category_description: Optional[str] = None
sub_category: int = 0
sub_category_description: Optional[str] = None
selection_code: Optional[str] = None
selection_code_description: Optional[str] = None
sell_serials_online: bool = False
notes: Optional[str] = None
images: Optional[List[ImageInfo]] = None
has_images: bool = False
variant_details: Optional[List[InventoryDetailByVariant]] = None
add_ons: Optional[List[AddOnDetail]] = None
active_e_info: Optional[ActiveEInfo] = None
weight: Decimal = decimal.Decimal(0)
unit: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchInventoryApiResult(SearchInventoryResultSet):
detail: Optional[InventoryDetail] = None
icon_image: Optional[ImageInfo] = None
customer_price: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchInventoryResponse(BaseResponse):
start_offset: int = 0
record_count: int = 0
remaining_records: int = 0
total_records: int = 0
# @ApiMember(Name="Records", ParameterType="body")
records: Optional[List[SearchInventoryApiResult]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchInventoryRequest(BaseSecureRequest):
"""
SearchInventoryRequires active-e Inventory Service
"""
# @ApiMember(DataType="integer", Description="If sent, only items from the passed location will be returned", Format="int32", Name="LocFk")
loc_fk: Optional[int] = None
"""
If sent, only items from the passed location will be returned
"""
# @ApiMember(DataType="integer", Description="For Internal Use Only", Format="int32", Name="MfgFk")
mfg_fk: Optional[int] = None
"""
For Internal Use Only
"""
# @ApiMember(DataType="integer", Description="For Internal Use Only", Format="int32", Name="CatFk")
cat_fk: Optional[int] = None
"""
For Internal Use Only
"""
# @ApiMember(DataType="integer", Description="For Internal Use Only", Format="int32", Name="SubFk")
sub_fk: Optional[int] = None
"""
For Internal Use Only
"""
# @ApiMember(DataType="integer", Description="For Internal Use Only", Format="int32", Name="SelFk")
sel_fk: Optional[int] = None
"""
For Internal Use Only
"""
# @ApiMember(DataType="integer", Description="If sent, only items from the passed category# will be returned", Format="int32", Name="Cat")
cat: Optional[int] = None
"""
If sent, only items from the passed category# will be returned
"""
# @ApiMember(DataType="integer", Description="If sent, only items from the passed subcategory# will be returned. Must be used in conjunction with the Cat parameter.", Format="int32", Name="Sub")
sub: Optional[int] = None
"""
If sent, only items from the passed subcategory# will be returned. Must be used in conjunction with the Cat parameter.
"""
# @ApiMember(Description="If sent, only items with the passed selection code will be returned", Name="SelectionCode")
selection_code: Optional[str] = None
"""
If sent, only items with the passed selection code will be returned
"""
# @ApiMember(Description="If sent, only items with the passed mfg code will be returned", Name="Mfg")
mfg: Optional[str] = None
"""
If sent, only items with the passed mfg code will be returned
"""
# @ApiMember(DataType="boolean", Description="Serialized Items will be included in the search results", Name="IncludeSerials")
include_serials: Optional[bool] = None
"""
Serialized Items will be included in the search results
"""
# @ApiMember(DataType="boolean", Description="Media Items will be included in the search results", Name="IncludeMedia")
include_media: Optional[bool] = None
"""
Media Items will be included in the search results
"""
# @ApiMember(DataType="boolean", Description="Non-Serialized, Non-Media Items will be included in the search results", Name="IncludeAccessories")
include_accessories: Optional[bool] = None
"""
Non-Serialized, Non-Media Items will be included in the search results
"""
# @ApiMember(DataType="boolean", Description="Package Deal Items will be included in the search results", Name="IncludePackages")
include_packages: Optional[bool] = None
"""
Package Deal Items will be included in the search results
"""
# @ApiMember(Description="The string to be searched for", Name="SearchStr")
search_str: Optional[str] = None
"""
The string to be searched for
"""
# @ApiMember(DataType="boolean", Description="If set, only items with the exact model contained in the search string will be returned", Name="ExactModel")
exact_model: Optional[bool] = None
"""
If set, only items with the exact model contained in the search string will be returned
"""
# @ApiMember(DataType="integer", Description="The Starting Offse", Format="int64", Name="StartOffset")
start_offset: Optional[int] = None
"""
The Starting Offse
"""
# @ApiMember(DataType="integer", Description="The # of records to be returned", Format="int64", Name="RecordCount")
record_count: Optional[int] = None
"""
The # of records to be returned
"""
# @ApiMember(DataType="boolean", Description="If set, Icon Image Urls will be included in the result, if available", Name="IncludeIconImage")
include_icon_image: Optional[bool] = None
"""
If set, Icon Image Urls will be included in the result, if available
"""
# @ApiMember(Description="If sent, only items from the passed category IDs will be returned", Name="CatIdList")
cat_id_list: Optional[List[int]] = None
"""
If sent, only items from the passed category IDs will be returned
"""
# @ApiMember(Description="If sent, only items from the passed subcategory IDs will be returned", Name="SubIdList")
sub_id_list: Optional[List[int]] = None
"""
If sent, only items from the passed subcategory IDs will be returned
"""
# @ApiMember(Description="If sent, only items from the passed mfg IDs will be returned", Name="MfgIdList")
mfg_id_list: Optional[List[int]] = None
"""
If sent, only items from the passed mfg IDs will be returned
"""
# @ApiMember(Description="If sent, only items from the passed selection code IDs will be returned", Name="SelIdList")
sel_id_list: Optional[List[int]] = None
"""
If sent, only items from the passed selection code IDs will be returned
"""
# @ApiMember(DataType="boolean", Description="Deleted Items will be included in the search results", Name="IncludeDeleted")
include_deleted: Optional[bool] = None
"""
Deleted Items will be included in the search results
"""
# @ApiMember(DataType="string", Description="If sent, only inventory changed on or after this date/time will be included", Format="date", Name="ChangedDate", ParameterType="query")
changed_date: Optional[datetime.datetime] = None
"""
If sent, only inventory changed on or after this date/time will be included
"""
# @ApiMember(DataType="boolean", Description="Package Deal Line Items will be included", Name="IncludePackageLineItems")
include_package_line_items: Optional[bool] = None
"""
Package Deal Line Items will be included
"""
# @ApiMember(DataType="boolean", Description="If set, the InventoryDetails object for each item will also be returned. This is much slower.", Name="IncludeDetails")
include_details: Optional[bool] = None
"""
If set, the InventoryDetails object for each item will also be returned. This is much slower.
"""
# @ApiMember(DataType="integer", Description="If sent, only items with an Available Quantity greater then or equal to the sent value will be returned. Use of this parameter requires that the LocFk parameter also be sent.", Format="int32", Name="MinimumAvailableQuantity")
minimum_available_quantity: Optional[int] = None
"""
If sent, only items with an Available Quantity greater then or equal to the sent value will be returned. Use of this parameter requires that the LocFk parameter also be sent.
"""
Python SearchInventoryRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/SearchInventory HTTP/1.1
Host: active-ewebservice.biz
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"LocFk":0,"MfgFk":0,"CatFk":0,"SubFk":0,"SelFk":0,"Cat":0,"Sub":0,"SelectionCode":"String","Mfg":"String","IncludeSerials":false,"IncludeMedia":false,"IncludeAccessories":false,"IncludePackages":false,"SearchStr":"String","ExactModel":false,"StartOffset":0,"RecordCount":0,"IncludeIconImage":false,"CatIdList":[0],"SubIdList":[0],"MfgIdList":[0],"SelIdList":[0],"IncludeDeleted":false,"ChangedDate":"0001-01-01T00:00:00.0000000","IncludePackageLineItems":false,"IncludeDetails":false,"MinimumAvailableQuantity":0,"Token":"String","DeviceId":"String","AppId":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"StartOffset":0,"RecordCount":0,"RemainingRecords":0,"TotalRecords":0,"Records":[{"Detail":{"SadPk":0,"InvType":"String","Model":"String","Description":"String","Mfg":"String","Category":0,"CategoryDescription":"String","SubCategory":0,"SubCategoryDescription":"String","SelectionCode":"String","SelectionCodeDescription":"String","SellSerialsOnline":false,"Notes":"String","Images":[{"Url":"String","ImageStream":"String","ImageSize":"String","ErrorMessage":"String","UriPk":0}],"HasImages":true,"VariantDetails":[{}],"AddOns":[{}],"ActiveEInfo":{"Dimension":"String","WebDescription":"String","Summary":"String","SETitle":"String","SEDescription":"String","SEKeywords":"String","SEAltText":"String","SEHtmlFreeText":"String","Unpublished":false,"FreeShipping":false,"IsFeatured":false,"WebCategoryIds":[0]},"Weight":0,"Unit":"String"},"IconImage":{"Url":"String","ImageStream":"String","ImageSize":"String","ErrorMessage":"String","UriPk":0},"CustomerPrice":0,"Pk":0,"Description":"String","InventoryType":"String","Manufacturer":"String","Model":"String","Category":0,"CategoryDescription":"String","SubCategory":0,"SubCategoryDescription":"String","SelectionCode":"String","SelectionCodeDescription":"String","Sku":"String","Mpn":"String","Discontinued":false,"Attribute1":"String","Attribute2":"String","Attribute3":"String","Attribute4":"String","Attribute5":"String","Attribute6":"String","Attribute7":"String","Attribute8":"String","Attribute9":"String","Attribute10":"String","Attribute11":"String","Attribute12":"String","Attribute13":"String","Attribute14":"String","Attribute15":"String","Attribute16":"String","Attribute17":"String","Attribute18":"String","Attribute19":"String","Attribute20":"String","ComputerQuantity":0,"OurPrice":0,"RetailPrice":0,"ActiveePrice":0,"PriceA":0,"PriceB":0,"PriceC":0,"MinPrice":0,"AvailableQuantity":0,"IsMedia":false,"IsPackage":false,"HasImage":false,"SearchTerm":"String","Keywords":"String","KeywordsOrigin":"String","Deleted":false,"PackageLineItems":[{"Model":"String","Cat":0,"Sub":0,"Description":"String","Quantity":0,"Amount":0,"Discount":0,"ItemType":"String"}]}],"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}