Booking API documentation version v1
http://dddsample.marcusoncode.se/booking/v1
/cargos
All booked cargos
Book a new cargo.
get /cargos
All booked cargos
HTTP status code 200
Body
Type: application/json
Example:
{
    "cargos": [
        {
            "arrival_deadline": "0001-01-01T00:00:00Z",
            "destination": "CNHKG",
            "misrouted": false,
            "origin": "SESTO",
            "routed": false,
            "tracking_id": "ABC123"
        },
        {
            "arrival_deadline": "0001-01-01T00:00:00Z",
            "destination": "SESTO",
            "misrouted": false,
            "origin": "AUMEL",
            "routed": false,
            "tracking_id": "FTL456"
        }
    ]
}
A specific cargo
get /cargos/{trackingId}
A specific cargo
URI Parameters
- trackingId: required (string)The tracking id of the cargo 
HTTP status code 200
Body
Type: application/json
Example:
{
    "cargo": {
        "arrival_deadline": "2016-03-30T22:00:00Z",
        "destination": "DEHAM",
        "legs": [
            {
                "voyage_number": "0300A",
                "from": "CNHKG",
                "to": "SESTO",
                "load_time": "2016-03-06T18:12:11.01579612Z",
                "unload_time": "2016-03-08T02:13:11.01579612Z"
            },
            {
                "voyage_number": "0400S",
                "from": "SESTO",
                "to": "FIHEL",
                "load_time": "2016-03-10T01:42:11.01579612Z",
                "unload_time": "2016-03-11T04:21:11.01579612Z"
            },
            {
                "voyage_number": "0100S",
                "from": "FIHEL",
                "to": "NLRTM",
                "load_time": "2016-03-13T08:42:11.01579612Z",
                "unload_time": "2016-03-14T01:38:11.01579612Z"
            }
        ],
        "misrouted": true,
        "origin": "CNHKG",
        "routed": true,
        "tracking_id": "D0909E1C"
    }
}
Assign given route to the cargo.
post /cargos/{trackingId}/assign_to_route
Assign given route to the cargo.
URI Parameters
- trackingId: required (string)The tracking id of the cargo 
Body
Type: application/json
Example:
{
    "legs": [
        {
            "voyage_number": "0301S",
            "from": "SESTO",
            "to": "FIHEL",
            "load_time": "2015-11-14T14:10:29.173391809Z",
            "unload_time": "2015-11-15T21:55:29.173391809Z"
        },
        {
            "voyage_number": "0100S",
            "from": "FIHEL",
            "to": "CNHKG",
            "load_time": "2015-11-18T02:19:29.173391809Z",
            "unload_time": "2015-11-19T04:11:29.173391809Z"
        }
    ]
}
Change destination of the cargo. May result in a misrouted cargo.
post /cargos/{trackingId}/change_destination
Change destination of the cargo. May result in a misrouted cargo.
URI Parameters
- trackingId: required (string)The tracking id of the cargo 
Body
Type: application/json
Example:
{
    "destination": "CNHKG" 
}
Requests routes based on current specification. Uses an external routing service provided by the routing package.
get /cargos/{trackingId}/request_routes
Requests routes based on current specification. Uses an external routing service provided by the routing package.
URI Parameters
- trackingId: required (string)The tracking id of the cargo 
HTTP status code 200
Body
Type: application/json
Example:
{
    "routes": [
        {
            "legs": [
                {
                    "voyage_number": "0301S",
                    "from": "SESTO",
                    "to": "FIHEL",
                    "load_time": "2015-11-14T14:10:29.173391809Z",
                    "unload_time": "2015-11-15T21:55:29.173391809Z"
                },
                {
                    "voyage_number": "0100S",
                    "from": "FIHEL",
                    "to": "CNHKG",
                    "load_time": "2015-11-18T02:19:29.173391809Z",
                    "unload_time": "2015-11-19T04:11:29.173391809Z"
                }
            ]
        },
        {
            "legs": [
                {
                    "voyage_number": "0400S",
                    "from": "SESTO",
                    "to": "JNTKO",
                    "load_time": "2015-11-14T06:22:29.173415471Z",
                    "unload_time": "2015-11-15T10:22:29.173415471Z"
                },
                {
                    "voyage_number": "0200T",
                    "from": "JNTKO",
                    "to": "CNHKG",
                    "load_time": "2015-11-17T10:45:29.173415471Z",
                    "unload_time": "2015-11-18T11:48:29.173415471Z"
                }
            ]
        }
    ]
}
/locations
All registered locations.
get /locations
All registered locations.
HTTP status code 200
Body
Type: application/json
Example:
{
    "locations": [
        {
            "locode": "DEHAM",
            "name": "Hamburg"
        },
        {
            "locode": "SESTO",
            "name": "Stockholm"
        },
        {
            "locode": "AUMEL",
            "name": "Melbourne"
        },
        {
            "locode": "CNHKG",
            "name": "Hongkong"
        },
        {
            "locode": "JNTKO",
            "name": "Tokyo"
        },
        {
            "locode": "NLRTM",
            "name": "Rotterdam"
        }
    ]
}