diff --git a/README.md b/README.md index 07fb437..c51d7f7 100644 --- a/README.md +++ b/README.md @@ -34,18 +34,23 @@ Your site does not allow external systems to feed information into it directly. Your approach will be to publish orders to GSS once the orders are ready for dispatch/labelling. On the GSS system your user would process the order. At some stage your system will request the order status update from GSS. The api interactions would be: -1. **[POST v2/neworder](https://github.com/gosweetspot/freight-api/blob/master/v2/POST_neworder.md)** - triggered from your site when order is ready for ticketting +
+1. **[POST api/customerorders](customerorders/post.md)** - triggered from your site when order is ready for ticketting +
2. Using the GSS web portal, your dispatcher tickets the goods. -3. **[GET v2/order](https://github.com/gosweetspot/freight-api/blob/master/v2/GET_order.md)** - triggered by your system every 6 hours, to get status update on the order published earlier. +
+3. **[GET api/customerorders](customerorders/get.md)** - triggered by your system every 6 hours, to get status update on the order published earlier. ### You have a very specialised dispatch workflow You might have a special requirement to integrate the ticketing directly into your existing system. Using a external system to do one part of the workflow may affect performance and may not be acceptable. You can use the GSS api to build the ticketing into your system. The api interactions would be: -1. **[POST ratesquery/availablerates](https://github.com/gosweetspot/freight-api/blob/master/ratesqueryv1/POST_availablerates.md)** - your system at dispatch, calls the api to get all available freight options and rates -2. **[POST ratesquery/createandprint](https://github.com/gosweetspot/freight-api/blob/master/ratesqueryv1/POST_createandprint.md)** - the dispatcher reviews the freight options from (1) and makes a selection. A second call to generate the shipment is triggered. +
+1. **[POST api/rates](rates/post.md)** - your system at dispatch, calls the api to get all available freight options and rates +
+2. **[POST api/shipments](shipments/post.md)** - the dispatcher reviews the freight options from (1) and makes a selection. A second call to generate the shipment is triggered. ### You use an open source platform -A lot of open source systems, also have a open api platform that GSS is able to tap into to build the integration directly from within GSS. We would consider any platform that our customers are using. However depending on platform popularity the implementation time frames would be considered. In the case that there are very few users on the platform, it may not be a sufficient business case for us to undertake the integration. +A lot of open source systems, also have a open API platform that GSS is able to tap into to build the integration directly from within GSS. We would consider any platform that our customers are using. However depending on platform popularity the implementation time frames would be considered. In the case that there are very few users on the platform, it may not be a sufficient business case for us to undertake the integration. ### Others Surely there will be other cases that the api can be applied to. Talk to us, and we will be able to help. @@ -60,33 +65,33 @@ Using this endpoint, you can publish from your ERP or orders system, into the GS - **[GET api/customerorders](/customerorders/get.md)** Retreives the list of orders already published to GSS. This can be filtered on multiple criteria. -- **[PUT api/customerorders](https://github.com/gosweetspot/freight-api/blob/master/v2/GET_order.md)** +- **[PUT api/customerorders](customerorders/put.md)** Publish into the GSS queue your orders. ### Price Enquiry / Rates Query -- **[POST api/rates](https://github.com/gosweetspot/freight-api/blob/master/ratesqueryv1/POST_availablerates.md)** Returns your available rates for the origin to destination specified. +- **[POST api/rates](ratesquery/post.md)** Returns your available rates for the origin to destination specified. ### Creating Shipments -- **[GET api/shipments](https://github.com/gosweetspot/freight-api/blob/master/ratesqueryv1/POST_printcheapestcourier.md)** Retreives all your historically created shipments, including current status details. -- **[POST api/shipments](https://github.com/gosweetspot/freight-api/blob/master/ratesqueryv1/POST_createandprint.md)** Create a new shipment using a rate or with auto rating. Printing can be automatically triggered as well. -- **[DELETE api/shipments](https://github.com/gosweetspot/freight-api/blob/master/v2/POST_deleteconnote.md)** Deletes the specified shipment. +- **[GET api/shipments](shipments/get.md)** Retreives all your historically created shipments, including current status details. +- **[POST api/shipments](shipments/post.md)** Create a new shipment using a rate or with auto rating. Printing can be automatically triggered as well. +- **[DELETE api/shipments](shipments/delete.md)** Deletes the specified shipment. ### Manifesting -- **[POST v2/publishmanifest](https://github.com/gosweetspot/freight-api/blob/master/v2/POST_publishmanifest.md)** Batch and manifest your current shipments ready for collection. Available on certain carriers only. +- **[POST v2/publishmanifest](manifests/post.md)** Batch and manifest your current shipments ready for collection. Available on certain carriers only. ### Printing -- **[GET /api/printers](https://github.com/gosweetspot/freight-api/blob/master/printers/get.md)** returns a list of available printers +- **[GET /api/printers](printers/get.md)** returns a list of available printers -- **[GET /api/labels](https://github.com/gosweetspot/freight-api/blob/master/labels/get.md)** download the labels as png or pdf +- **[GET /api/labels](labels/get.md)** download the labels as png or pdf -- **[POST /api/labels](https://github.com/gosweetspot/freight-api/blob/master/labels/post.md)** enqueues the supplied shipment for printing +- **[POST /api/labels](labels/post.md)** enqueues the supplied shipment for printing -- **[POST /api/labels/enqueue](https://github.com/gosweetspot/freight-api/blob/master/labels/enqueue.md)** enqueues a raw image into the print queue for printing +- **[POST /api/labels/enqueue](labels/enqueue.md)** enqueues a raw image into the print queue for printing -- **[POST ratesquery/reprint](https://github.com/gosweetspot/freight-api/blob/master/ratesqueryv1/POST_reprint.md)** -- **[GET labels/download](https://github.com/gosweetspot/freight-api/blob/master/labels/GET_download.md)** +- **[POST ratesquery/reprint](labels/ratesqueryv1/POST_reprint.md)** +- **[GET labels/download](labels/GET_download.md)** ### Webhooks GSS is able to provide feedback to your site using webhooks for certain action triggers. diff --git a/rates/post.md b/rates/post.md new file mode 100644 index 0000000..84d122f --- /dev/null +++ b/rates/post.md @@ -0,0 +1,197 @@ +# Available Rates + + POST api/rates + +## Description +Query to get available courier services and rates for the destination. + +*** + +## Requires authentication +* A valid access Key must be provided in **access_key** request header. + +*** + +## Parameters +- **origin** - Specify the unique order number from your source system, that was used as the packing slip no when the order was published +- **destination** - JSON object of destination address +- **packages** - JSON object array of package objects +- **issaturdaydelivery** - true/false +- **issignaturerequired** - true/false +- **dutiesandtaxesbyreceiver** - true/false +- **ruraloverride** - true/false +- **deliveryreference** - string:60, order reference + +*origin/destination Object* +- **name** - string:60, Company name or persons name +- **contactperson** - string:60, contact person at address, optional +- **phonenumber** - string:60, phone number, optional +- **isrural** - true/false, optional +- **deliveryinstructions** - string:120, special instructions to print on the label. For origin this field is ignored. +- **sendtrackingemail** - true/false, optional +- **costcentreid** - int, optional +- **explicitnotrural** - true/false, when true not rural surcharges are added. +- **address** - JSON Object as described below + +*address Object* +- **buildingname** - string:60, property identifier, such as Unit 1, Level 10, Panasonic House, etc +- **streetaddress** - string:60, street number and name. +- **suburb** - string:60, suburb name +- **city** - string:60, city or state name. In countries where there are official states, use use use state abbreviations, such as California = CA, New South Wales = NSW, etc. +- **postcode** - string:10, postal code +- **countrycode** - string:2, ISO Alpha 2 country code, eg, NZ, AU, US, GB, CN, CA, etc. + +*package Object* +- **name** - string:15, package custom name, if none available, use "custom" +- **length** - integer, package length in centimetres +- **width** - integer, package width in centimetres +- **height** - integer, package height in centimetres +- **kg** - decimal, package weight in kilograms +- **type** - string:10, package type, eg, Box, Carton, Satchel, Bag, Pallet, etc +- **packagecode** - string:5, Trackpack codes, such as DLE, A5, A4 (please consult support before providing a value in this field) This feature is not available on all accounts. + + +## Return format +A JSON object array of available rates. These are group into *Available*, *Hidden*, *Rejected*. +The *Hidden* rates, are available rates, but have been filtered out due to user preference, based on cost centre, or destination courier preference. + +**Available/Hidden** +- **quoteId** - unqiue rates calculation identifier +- **carriername** - display name of courier provider +- **deliverytype** - courier delivery/service type +- **cost** - freight cost +- **servicestandard** - courier service wording. +- **comments** - any extra comments supplied with this rate +- **route** - courier provider specific freight routing +- **isruraldelivery** - if delivery has been identified as a rural aread delivery +- **issaturdaydelivery** - if delivery has been flagged for saturday delivery +- **isfreightforward** - if pickup is originating from an address other then the site address +- **carrierservicetype** - carrier provider service type + +**Rejected** +- **carriername** - courier provider name +- **deliverytype** - courier delivery/service type +- **reason** - reason why this rates line was ignored. + +**ValidationErrors** +- **key** - field name +- **value** - reason for validation failure + + + +*** + +## Errors +If there are any validation errors these are reported via the *ValidationErrors* JSON object. + +*** + +## Example +**Request** + + http://api.gosweetspot.com/api/rates + +*Headers* + + access_key: [access_key_for_site_account] + Content-Type: application/json; charset=utf-8 + + + +*Body* +``` json +{ + "DeliveryReference": "ORDER123", + "Destination": { + "Id": 0, + "Name": "DestinationName", + "Address": { + "BuildingName": "", + "StreetAddress": "DestinationStreetAddress", + "Suburb": "Avonside", + "City": "Christchurch", + "PostCode": "8061", + "CountryCode": "NZ" + }, + "ContactPerson": "DestinationContact", + "PhoneNumber": "123456789", + "Email": "destinationemail@email.com", + "DeliveryInstructions": "Desinationdeliveryinstructions" + }, + "IsSaturdayDelivery": false, + "IsSignatureRequired": true, + "Packages": [ + { + "Height": 1, + "Length": 1, + "Id": 0, + "Width": 10, + "Kg": 0.1, + "Name": "GSS-DLE SATCHEL", + "PackageCode": "DLE", + "Type": "Box" + } + ] +} +``` + + +**Response** +``` json +{ + "Available": [ + { + "QuoteId": "3104eb7e-6354-4de4-a250-fa96297282d2", + "CarrierId": 102, + "CarrierName": "Post Haste", + "DeliveryType": "Overnight", + "Cost": 8.58, + "ServiceStandard": "By 11am next business day", + "Comments": "Satchel ", + "Route": "AKL- LOCAL->AKL- SI", + "IsRuralDelivery": false, + "IsSaturdayDelivery": false, + "IsFreightForward": false, + "CarrierServiceType": "DomesticCourier" + }, + { + "QuoteId": "22401e18-e097-4ac8-9e6f-271734e92a50", + "CarrierId": 147, + "CarrierName": "PBT Couriers", + "DeliveryType": "Overnight", + "Cost": 8.89, + "ServiceStandard": "By 12pm next business day", + "Comments": "Satchel ", + "Route": "AKL- LOCAL->AKL- SI", + "IsRuralDelivery": false, + "IsSaturdayDelivery": false, + "IsFreightForward": false, + "CarrierServiceType": "DomesticCourier" + }, + { + "QuoteId": "489898a3-85e8-47fe-8184-916dd75b2b79", + "CarrierId": 205, + "CarrierName": "Mainstream Freight", + "DeliveryType": "Standard", + "Cost": 65.42, + "ServiceStandard": "Next day within island, 2 day inter island", + "Comments": "VM ", + "Route": "MS-AKL->CHRISTCHURCH", + "IsRuralDelivery": false, + "IsSaturdayDelivery": false, + "IsFreightForward": false, + "CarrierServiceType": "DomesticBulk" + } + ], + "Rejected": [ + { + "Reason": "MS-AKL -> CHRISTCHURCH: Consignment undersize/weight", + "Carrier": "Mainstream AKL", + "DeliveryType": "Standard 1000kg+" + } + ], + "ValidationErrors": { + } +} + +``` diff --git a/ratesquery/post.md b/ratesquery/post.md new file mode 100644 index 0000000..6c47f33 --- /dev/null +++ b/ratesquery/post.md @@ -0,0 +1,197 @@ +# Available Rates + + POST api/ratesquery + +## Description +Query to get available courier services and rates for the destination. + +*** + +## Requires authentication +* A valid access Key must be provided in **access_key** request header. + +*** + +## Parameters +- **origin** - Specify the unique order number from your source system, that was used as the packing slip no when the order was published +- **destination** - JSON object of destination address +- **packages** - JSON object array of package objects +- **issaturdaydelivery** - true/false +- **issignaturerequired** - true/false +- **dutiesandtaxesbyreceiver** - true/false +- **ruraloverride** - true/false +- **deliveryreference** - string:60, order reference + +*origin/destination Object* +- **name** - string:60, Company name or persons name +- **contactperson** - string:60, contact person at address, optional +- **phonenumber** - string:60, phone number, optional +- **isrural** - true/false, optional +- **deliveryinstructions** - string:120, special instructions to print on the label. For origin this field is ignored. +- **sendtrackingemail** - true/false, optional +- **costcentreid** - int, optional +- **explicitnotrural** - true/false, when true not rural surcharges are added. +- **address** - JSON Object as described below + +*address Object* +- **buildingname** - string:60, property identifier, such as Unit 1, Level 10, Panasonic House, etc +- **streetaddress** - string:60, street number and name. +- **suburb** - string:60, suburb name +- **city** - string:60, city or state name. In countries where there are official states, use use use state abbreviations, such as California = CA, New South Wales = NSW, etc. +- **postcode** - string:10, postal code +- **countrycode** - string:2, ISO Alpha 2 country code, eg, NZ, AU, US, GB, CN, CA, etc. + +*package Object* +- **name** - string:15, package custom name, if none available, use "custom" +- **length** - integer, package length in centimetres +- **width** - integer, package width in centimetres +- **height** - integer, package height in centimetres +- **kg** - decimal, package weight in kilograms +- **type** - string:10, package type, eg, Box, Carton, Satchel, Bag, Pallet, etc +- **packagecode** - string:5, Trackpack codes, such as DLE, A5, A4 (please consult support before providing a value in this field) This feature is not available on all accounts. + + +## Return format +A JSON object array of available rates. These are group into *Available*, *Hidden*, *Rejected*. +The *Hidden* rates, are available rates, but have been filtered out due to user preference, based on cost centre, or destination courier preference. + +**Available/Hidden** +- **quoteId** - unqiue rates calculation identifier +- **carriername** - display name of courier provider +- **deliverytype** - courier delivery/service type +- **cost** - freight cost +- **servicestandard** - courier service wording. +- **comments** - any extra comments supplied with this rate +- **route** - courier provider specific freight routing +- **isruraldelivery** - if delivery has been identified as a rural aread delivery +- **issaturdaydelivery** - if delivery has been flagged for saturday delivery +- **isfreightforward** - if pickup is originating from an address other then the site address +- **carrierservicetype** - carrier provider service type + +**Rejected** +- **carriername** - courier provider name +- **deliverytype** - courier delivery/service type +- **reason** - reason why this rates line was ignored. + +**ValidationErrors** +- **key** - field name +- **value** - reason for validation failure + + + +*** + +## Errors +If there are any validation errors these are reported via the *ValidationErrors* JSON object. + +*** + +## Example +**Request** + + http://api.gosweetspot.com/api/ratesquery + +*Headers* + + access_key: [access_key_for_site_account] + Content-Type: application/json; charset=utf-8 + + + +*Body* +``` json +{ + "DeliveryReference": "ORDER123", + "Destination": { + "Id": 0, + "Name": "DestinationName", + "Address": { + "BuildingName": "", + "StreetAddress": "DestinationStreetAddress", + "Suburb": "Avonside", + "City": "Christchurch", + "PostCode": "8061", + "CountryCode": "NZ" + }, + "ContactPerson": "DestinationContact", + "PhoneNumber": "123456789", + "Email": "destinationemail@email.com", + "DeliveryInstructions": "Desinationdeliveryinstructions" + }, + "IsSaturdayDelivery": false, + "IsSignatureRequired": true, + "Packages": [ + { + "Height": 1, + "Length": 1, + "Id": 0, + "Width": 10, + "Kg": 0.1, + "Name": "GSS-DLE SATCHEL", + "PackageCode": "DLE", + "Type": "Box" + } + ] +} +``` + + +**Response** +``` json +{ + "Available": [ + { + "QuoteId": "3104eb7e-6354-4de4-a250-fa96297282d2", + "CarrierId": 102, + "CarrierName": "Post Haste", + "DeliveryType": "Overnight", + "Cost": 8.58, + "ServiceStandard": "By 11am next business day", + "Comments": "Satchel ", + "Route": "AKL- LOCAL->AKL- SI", + "IsRuralDelivery": false, + "IsSaturdayDelivery": false, + "IsFreightForward": false, + "CarrierServiceType": "DomesticCourier" + }, + { + "QuoteId": "22401e18-e097-4ac8-9e6f-271734e92a50", + "CarrierId": 147, + "CarrierName": "PBT Couriers", + "DeliveryType": "Overnight", + "Cost": 8.89, + "ServiceStandard": "By 12pm next business day", + "Comments": "Satchel ", + "Route": "AKL- LOCAL->AKL- SI", + "IsRuralDelivery": false, + "IsSaturdayDelivery": false, + "IsFreightForward": false, + "CarrierServiceType": "DomesticCourier" + }, + { + "QuoteId": "489898a3-85e8-47fe-8184-916dd75b2b79", + "CarrierId": 205, + "CarrierName": "Mainstream Freight", + "DeliveryType": "Standard", + "Cost": 65.42, + "ServiceStandard": "Next day within island, 2 day inter island", + "Comments": "VM ", + "Route": "MS-AKL->CHRISTCHURCH", + "IsRuralDelivery": false, + "IsSaturdayDelivery": false, + "IsFreightForward": false, + "CarrierServiceType": "DomesticBulk" + } + ], + "Rejected": [ + { + "Reason": "MS-AKL -> CHRISTCHURCH: Consignment undersize/weight", + "Carrier": "Mainstream AKL", + "DeliveryType": "Standard 1000kg+" + } + ], + "ValidationErrors": { + } +} + +```