Trendsic Platform Service

<back to all web services

ProductsRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET/v1/Products/{UserID}
GET,POST,PUT,DELETE,OPTIONS/v1/Products/
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 Product:
    id: int = 0
    product_name: Optional[str] = None
    product_type_i_d: int = 0
    unit_price: Decimal = decimal.Decimal(0)
    description: Optional[str] = None
    image_u_r_l: Optional[str] = None
    image_key: Optional[str] = None
    special_sale_text: Optional[str] = None
    ship_price: Decimal = decimal.Decimal(0)
    sale_price: Decimal = decimal.Decimal(0)
    uid: Optional[str] = None
    product_category: int = 0
    product_sub_category: int = 0
    product_weight: Decimal = decimal.Decimal(0)
    freight_markup_percent: Decimal = decimal.Decimal(0)
    freight_mark_up_amount: Decimal = decimal.Decimal(0)
    point_value: Decimal = decimal.Decimal(0)
    is_active: bool = False
    stripe_product_id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProductsResponse:
    response_status: Optional[ResponseStatus] = None
    products: List[Product] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProductsRequest:
    user_i_d: Optional[str] = None
    products: List[Product] = field(default_factory=list)

Python ProductsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/Products/ HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"UserID":"00000000000000000000000000000000","Products":[{"ID":0,"ProductName":"String","ProductTypeID":0,"UnitPrice":0,"Description":"String","ImageURL":"String","ImageKey":"String","SpecialSaleText":"String","ShipPrice":0,"SalePrice":0,"UID":"00000000000000000000000000000000","ProductCategory":0,"ProductSubCategory":0,"ProductWeight":0,"FreightMarkupPercent":0,"FreightMarkUpAmount":0,"PointValue":0,"IsActive":false,"StripeProductId":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Products":[{"ID":0,"ProductName":"String","ProductTypeID":0,"UnitPrice":0,"Description":"String","ImageURL":"String","ImageKey":"String","SpecialSaleText":"String","ShipPrice":0,"SalePrice":0,"UID":"00000000000000000000000000000000","ProductCategory":0,"ProductSubCategory":0,"ProductWeight":0,"FreightMarkupPercent":0,"FreightMarkUpAmount":0,"PointValue":0,"IsActive":false,"StripeProductId":"String"}]}