2Service Services API

<back to all web services

GetShipment

The following routes are available for this service:
GET/dealers/shipment/{ShipmentId}Retrieves shipment based on it's ID.
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
Object = TypeVar('Object')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AuthenticatedRequest:
    # @ApiMember(Description="Session token received from successful authentication.", IsRequired=true, ParameterType="query")
    session_token: Optional[str] = None
    """
    Session token received from successful authentication.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ShipmentArticleResult:
    # @ApiMember(Description="Order number.")
    order_number: Optional[str] = None
    """
    Order number.
    """


    # @ApiMember(Description="Article number.")
    article_number: Optional[str] = None
    """
    Article number.
    """


    # @ApiMember(Description="Quantity.")
    quantity: int = 0
    """
    Quantity.
    """


    # @ApiMember(Description="Custom reference.")
    custom_reference: Optional[str] = None
    """
    Custom reference.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ShipmentPackageResult:
    # @ApiMember(Description="Shipment method.")
    shipment_method: Optional[str] = None
    """
    Shipment method.
    """


    # @ApiMember(Description="Tracking number.")
    tracking_number: Optional[str] = None
    """
    Tracking number.
    """


    # @ApiMember(Description="Tracking URL.")
    tracking_url: Optional[str] = None
    """
    Tracking URL.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ShipmentResult:
    # @ApiMember(Description="ID of the shipment.")
    shipment_id: int = 0
    """
    ID of the shipment.
    """


    # @ApiMember(Description="Determines of the shipment has been dispatched.")
    has_been_dispatched: bool = False
    """
    Determines of the shipment has been dispatched.
    """


    # @ApiMember(Description="Date/time of dispatch.")
    dispatch_date: Optional[datetime.datetime] = None
    """
    Date/time of dispatch.
    """


    # @ApiMember(Description="List of articles in shipment.")
    articles: Optional[List[ShipmentArticleResult]] = None
    """
    List of articles in shipment.
    """


    # @ApiMember(Description="List of packages for shipment.")
    packages: Optional[List[ShipmentPackageResult]] = None
    """
    List of packages for shipment.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OperationResult:
    # @ApiMember(Description="Specifies if the operation was successful.", ParameterType="model")
    is_successful: bool = False
    """
    Specifies if the operation was successful.
    """


    # @ApiMember(Description="States error message in case of unsuccessful operation.", ParameterType="model")
    error_message: Optional[str] = None
    """
    States error message in case of unsuccessful operation.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PartInfoResultImage:
    # @ApiMember(Description="Image number")
    image_number: int = 0
    """
    Image number
    """


    # @ApiMember(Description="Image URL")
    image_url: Optional[str] = None
    """
    Image URL
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PartStockQuantity:
    # @ApiMember(Description="Location ID")
    location_id: int = 0
    """
    Location ID
    """


    # @ApiMember(Description="Location code")
    location_code: Optional[str] = None
    """
    Location code
    """


    # @ApiMember(Description="Stock quantity in location")
    stock_quantity: int = 0
    """
    Stock quantity in location
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PartInfoResult:
    # @ApiMember(Description="Unique ID for the part.")
    id: int = 0
    """
    Unique ID for the part.
    """


    # @ApiMember(Description="Part number.")
    part_number: Optional[str] = None
    """
    Part number.
    """


    # @ApiMember(Description="Description of the part.")
    description: Optional[str] = None
    """
    Description of the part.
    """


    # @ApiMember(Description="Part manufacturer.")
    manufacturer: Optional[str] = None
    """
    Part manufacturer.
    """


    # @ApiMember(Description="Determines if the part can be ordered.")
    can_be_ordered: bool = False
    """
    Determines if the part can be ordered.
    """


    # @ApiMember(Description="Textual representation of the status of the part.")
    status_text: Optional[str] = None
    """
    Textual representation of the status of the part.
    """


    # @ApiMember(Description="Available stock to order.")
    available_stock_quantity: int = 0
    """
    Available stock to order.
    """


    # @ApiMember(Description="Average days needed for delivery.")
    average_delivery_in_days: Optional[int] = None
    """
    Average days needed for delivery.
    """


    # @ApiMember(Description="Price of a single unit, excluding VAT.")
    unit_price: Optional[Decimal] = None
    """
    Price of a single unit, excluding VAT.
    """


    # @ApiMember(Description="EAN number.")
    ean_number: Optional[str] = None
    """
    EAN number.
    """


    # @ApiMember(Description="Images")
    images: Optional[List[PartInfoResultImage]] = None
    """
    Images
    """


    # @ApiMember(Description="Secondary article numbers")
    secondary_article_numbers: Optional[List[str]] = None
    """
    Secondary article numbers
    """


    # @ApiMember(Description="Replacement article numbers")
    replacement_article_numbers: Optional[List[str]] = None
    """
    Replacement article numbers
    """


    # @ApiMember(Description="Stock quantities")
    stock_quantities: Optional[List[PartStockQuantity]] = None
    """
    Stock quantities
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PartResults:
    # @ApiMember(Description="Total number of parts available.")
    total_number_of_parts: int = 0
    """
    Total number of parts available.
    """


    # @ApiMember(Description="Indication if there are more parts to retrieve.")
    has_more_records: bool = False
    """
    Indication if there are more parts to retrieve.
    """


    # @ApiMember(Description="Part records.")
    parts: Optional[List[PartInfoResult]] = None
    """
    Part records.
    """


T = TypeVar('T')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OperationResult1(Generic[T], OperationResult):
    # @ApiMember(Description="Result value", ParameterType="model")
    result: Optional[PartResults] = None
    """
    Result value
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ShipmentResponse(OperationResult1[ShipmentResult]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetShipment(AuthenticatedRequest):
    # @ApiMember(Description="Shipment ID to retrieve the status for.", IsRequired=true, ParameterType="path")
    shipment_id: int = 0
    """
    Shipment ID to retrieve the status for.
    """

Python GetShipment DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /dealers/shipment/{ShipmentId} HTTP/1.1 
Host: services.acct.2service.nl 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Result":{"ShipmentId":0,"HasBeenDispatched":false,"DispatchDate":"0001-01-01T00:00:00.0000000","Articles":[{"OrderNumber":"String","ArticleNumber":"String","Quantity":0,"CustomReference":"String"}],"Packages":[{"ShipmentMethod":"String","TrackingNumber":"String","TrackingUrl":"String"}]},"IsSuccessful":false,"ErrorMessage":"String"}