GET | /supplier |
---|
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 ResponseBase:
response_status: Optional[ResponseStatus] = None
class BusinessType(IntEnum):
COMPANY = 0
PRIVATE_ENTREPRENEUR = 1
NON_PROFIT = 2
LAW_OFFICE = 3
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupplierSimple:
id: int = 0
owner_id: int = 0
vat_number: Optional[str] = None
business_type: Optional[BusinessType] = None
country_id: int = 0
name: Optional[str] = None
short_name: Optional[str] = None
registration_number: Optional[str] = None
established_date: datetime.datetime = datetime.datetime(1, 1, 1)
registration_date: datetime.datetime = datetime.datetime(1, 1, 1)
duns: Optional[str] = None
operating_license_number: Optional[str] = None
is_accounting: bool = False
is_small_tax_payer: bool = False
email: Optional[str] = None
phone_number: Optional[str] = None
website: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BrowseAllSupplierResponse(ResponseBase):
suppliers: Optional[List[SupplierSimple]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BrowseAllSupplier(IGet):
pass
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.
GET /supplier HTTP/1.1 Host: szallitoiportal-be.veolia.hu Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Suppliers: [ { Id: 0, OwnerId: 0, VatNumber: String, BusinessType: 0, CountryId: 0, Name: String, ShortName: String, RegistrationNumber: String, EstablishedDate: 0001-01-01, RegistrationDate: 0001-01-01, Duns: String, OperatingLicenseNumber: String, IsAccounting: False, IsSmallTaxPayer: False, Email: String, PhoneNumber: String, Website: String } ], ResponseStatus: { ErrorCode: String, Message: String, StackTrace: String, Errors: [ { ErrorCode: String, FieldName: String, Message: String, Meta: { String: String } } ], Meta: { String: String } } }