Pecuario.Backend

<back to all web services

PublishProduct

Requires Authentication
The following routes are available for this service:
POST/api/v1/marketplace/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 Status:
    message: Optional[str] = None
    status_code: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponse:
    status: Optional[Status] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PublishProductResponse(BaseResponse):
    id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PublishProduct(IPost):
    category_name: Optional[str] = None
    product_name: Optional[str] = None
    supplier: Optional[str] = None
    company_name: Optional[str] = None
    region_id: int = 0
    city_id: int = 0
    description: Optional[str] = None
    home_delivery: Optional[bool] = None
    price: Decimal = decimal.Decimal(0)

Python PublishProduct DTOs

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

HTTP + JSV

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

POST /api/v1/marketplace/products HTTP/1.1 
Host: pecuario-backend.develsystems.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	categoryName: String,
	productName: String,
	supplier: String,
	companyName: String,
	regionId: 0,
	cityId: 0,
	description: String,
	homeDelivery: False,
	price: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: String
}