| POST | /quote/validatewaypoints | Validate the waypoints for a client. |
|---|
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 ApiServiceRequest(IServiceRequest, IHasApiKey):
# @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
api_key: Optional[str] = None
"""
The API Key required for authentication
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiServiceResponse(IServiceResponse):
# @ApiMember(Description="Information about the response.", IsRequired=true)
description: Optional[str] = None
"""
Information about the response.
"""
# @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
heading: Optional[str] = None
"""
Heading or summary of the response.
"""
# @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
was_successful: bool = False
"""
Did the intended operation for this response complete successfully?
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class WaypointValidationInformation:
waypoint_number: int = 0
is_valid: bool = False
error_messages: Optional[List[str]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LinkedWaypoint:
from_waypoint_number: int = 0
to_waypoint_number: int = 0
from_latitude: float = 0.0
from_longitude: float = 0.0
to_latitude: float = 0.0
to_longitude: float = 0.0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class WaypointQuoteInformation(LinkedWaypoint):
# @ApiMember(Description="Distance between waypoints as a number")
distance: float = 0.0
"""
Distance between waypoints as a number
"""
# @ApiMember(Description="String formatted distance")
distance_value: Optional[str] = None
"""
String formatted distance
"""
waypoint_valid: bool = False
message: Optional[str] = None
error_details: Optional[List[str]] = None
# @ApiMember(Description="Caculated price between waypoints excluding vat")
price: Decimal = decimal.Decimal(0)
"""
Caculated price between waypoints excluding vat
"""
# @ApiMember(Description="Price excluding vat formatted as a string rand value")
price_value: Optional[str] = None
"""
Price excluding vat formatted as a string rand value
"""
# @ApiMember(Description="The price between waypoints including vat")
price_with_v_a_t: Decimal = decimal.Decimal(0)
"""
The price between waypoints including vat
"""
# @ApiMember(Description="The price including vat formatted as a rand value string")
price_value_with_v_a_t: Optional[str] = None
"""
The price including vat formatted as a rand value string
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ValidateWaypointsResponse(ApiServiceResponse):
# @ApiMember(Description="List with validation information for each waypoint")
waypoint_validations: Optional[List[WaypointValidationInformation]] = None
"""
List with validation information for each waypoint
"""
# @ApiMember(Description="The total distance for the order")
total_distance: float = 0.0
"""
The total distance for the order
"""
# @ApiMember(Description="The total distance for the order, formatted as a string")
total_distance_value: Optional[str] = None
"""
The total distance for the order, formatted as a string
"""
# @ApiMember(Description="List of information for pricing etc between each waypoint")
waypoints: Optional[List[WaypointQuoteInformation]] = None
"""
List of information for pricing etc between each waypoint
"""
# @ApiMember(Description="Is there an issue for the waypoints details specified?")
waypoint_issue: bool = False
"""
Is there an issue for the waypoints details specified?
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RequestQuoteWaypoint(IRequestWaypoint):
# @ApiMember(Description="Number of waypoint for ordering", IsRequired=true)
waypoint_number: int = 0
"""
Number of waypoint for ordering
"""
# @ApiMember(Description="Waypoint Latitude", IsRequired=true)
latitude: float = 0.0
"""
Waypoint Latitude
"""
# @ApiMember(Description="Waypoint Longitude", IsRequired=true)
longitude: float = 0.0
"""
Waypoint Longitude
"""
# @ApiMember(Description="Name of contact person at waypoint", IsRequired=true)
contact_name: Optional[str] = None
"""
Name of contact person at waypoint
"""
# @ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)
contact_number: Optional[str] = None
"""
Telephone number of contact person at waypoint
"""
# @ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)
delivery_instructions: Optional[str] = None
"""
Instructions for driver to follow at waypoint
"""
# @ApiMember(Description="Waypoint address", IsRequired=true)
address: Optional[str] = None
"""
Waypoint address
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ValidateWaypoints(ApiServiceRequest, ILogRequest):
# @ApiMember(Description="Array of waypoints", IsRequired=true)
waypoints: Optional[List[RequestQuoteWaypoint]] = None
"""
Array of waypoints
"""
# @ApiMember(Description="Set this to true to prevent while testing the API.", IsRequired=true)
test: bool = False
"""
Set this to true to prevent while testing the API.
"""
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /quote/validatewaypoints HTTP/1.1
Host: 1fetch.api.client.prod.86degrees.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"Waypoints":[{"WaypointNumber":0,"Latitude":0,"Longitude":0,"ContactName":"String","ContactNumber":"String","DeliveryInstructions":"String","Address":"String"}],"Test":false,"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{Unable to show example output for type 'ValidateWaypointsResponse' using the custom 'csv' filter}One or more errors occurred. (Object reference not set to an instance of an object.)