Trendsic Platform Service

<back to all web services

CourierBookQuoteRequest

The following routes are available for this service:
POST,OPTIONS/v1/book/{Slug}/quote
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 CourierBookQuoteLine:
    kind: Optional[str] = None
    amount: Decimal = decimal.Decimal(0)
    qty: Optional[Decimal] = None
    rate: Optional[Decimal] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierBookQuoteResponse:
    zone: Optional[str] = None
    miles: Optional[Decimal] = None
    lines: List[CourierBookQuoteLine] = field(default_factory=list)
    total: Decimal = decimal.Decimal(0)
    response_status: Optional[ResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierBookQuoteRequest:
    slug: Optional[str] = None
    profile: Optional[str] = None
    level: Optional[str] = None
    units: int = 0
    zip: Optional[str] = None
    lat: Optional[Decimal] = None
    lng: Optional[Decimal] = None
    drop_lat: Optional[Decimal] = None
    drop_lng: Optional[Decimal] = None

Python CourierBookQuoteRequest 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 /v1/book/{Slug}/quote HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Slug: String,
	Profile: String,
	Level: String,
	Units: 0,
	Zip: String,
	Lat: 0,
	Lng: 0,
	DropLat: 0,
	DropLng: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Zone: String,
	Miles: 0,
	Lines: 
	[
		{
			Kind: String,
			Amount: 0,
			Qty: 0,
			Rate: 0
		}
	],
	Total: 0,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}