| GET, POST | /2/search |
|---|
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 Search2Response(IResponse):
response_status: Optional[ResponseStatus] = None
result: Optional[List[PriceListModel]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Search2:
q: Optional[str] = None
token_id: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PriceListModel(PriceListModel):
is_original: Optional[bool] = None
group_id: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PriceListModel:
product_id: Optional[str] = None
manufacturer_title: Optional[str] = None
product_number: Optional[str] = None
product_title: Optional[str] = None
price_list_id: Optional[str] = None
code: Optional[str] = None
delivery: Optional[str] = None
location: Optional[str] = None
expected_delivery_days: Optional[int] = None
guaranteed_delivery_days: Optional[int] = None
quantity: Optional[int] = None
pack: Optional[int] = None
price: Optional[Decimal] = None
use_schedule: Optional[bool] = None
order_date: Optional[datetime.datetime] = None
delivery_date: Optional[datetime.datetime] = None
delivery_chance: Optional[float] = None
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 /2/search HTTP/1.1
Host: api.oszz.ru
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
q: String,
tokenId: 00000000000000000000000000000000
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
responseStatus:
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
},
result:
[
{
isOriginal: False,
groupId: 0,
productId: 00000000000000000000000000000000,
manufacturerTitle: String,
productNumber: String,
productTitle: String,
priceListId: 00000000000000000000000000000000,
code: String,
delivery: String,
location: String,
expectedDeliveryDays: 0,
guaranteedDeliveryDays: 0,
quantity: 0,
pack: 0,
price: 0,
useSchedule: False,
orderDate: 0001-01-01,
deliveryDate: 0001-01-01,
deliveryChance: 0
}
]
}