| Requires any of the roles: | dealer-api-mds, dealer-api-nop |
| All Verbs | /part/{PartId} |
|---|
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 PartDetail:
id: int = 0
inventory_id: Optional[str] = None
name: Optional[str] = None
active: bool = False
date_last_update: Optional[datetime.datetime] = None
rrp: Optional[Decimal] = None
trade_price: Optional[Decimal] = None
dealer_price: Optional[Decimal] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PartResponse:
response_status: Optional[ResponseStatus] = None
is_success: bool = False
message: Optional[str] = None
item: Optional[PartDetail] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Part:
part_id: int = 0
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 /part/{PartId} HTTP/1.1
Host: mds-api.mojomotorcycles.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
PartId: 0
}
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
}
},
IsSuccess: False,
Message: String,
Item:
{
Id: 0,
InventoryId: String,
Name: String,
Active: False,
DateLastUpdate: 0001-01-01,
RRP: 0,
TradePrice: 0,
DealerPrice: 0
}
}