Allocate using default allocation rules
Automatically allocate assign to the cheapest eligible carrier with one request using predefined business rules in Consignments.
Overview
The allocate using default rules and allocate consignments endpoints enable you to allocate packages to the cheapest eligible carrier service. The Consignments platform selects a service for you when you use these endpoints, rather than requiring you to select a service or service group manually.
This guide explains how to use the allocate using default rules and allocate consignment endpoints to allocate packages based on your pre-defined allocation rules.
The Consignments platform uses the following selection process when allocating via these endpoints:
- Who can deliver? - First, Consignments compiles a list of all carrier services that could potentially take the consignment (that is, configured and enabled services that ship to the delivery address and could meet any specified delivery promise).
- Who meets the allocation rules? - Next, Consignments creates a final shortlist of carrier services by eliminating any services that do not meet your organisation’s own allocation rules. For information on using allocation rules, see the what is an allocation rule? section of the allocate packages to carriers page.
- Who is cheapest? - Finally, Consignments allocates the consignment to the cheapest service on the shortlist.
Allocating Multiple Consignments at Once
The Allocate Using Default Rules endpoint enables you to allocate multiple packages to the cheapest eligible carrier service in one request.
To call Allocate using Default Rules, send a PUT
request to https://api.electioapp.com/allocation/allocate
. The request body should contain an array of one or more {consignmentReference}
s to be allocated.
Once the request is received, Consignments takes each package in turn and allocates it to the cheapest eligible carrier, as per the process detailed in the Overview header. It then returns an array of Allocation Summaries, one for each allocated package.
For full reference information on the Allocate Using Default Rules endpoint, see the Allocate using default rules page of the API reference."/>
Example: Allocate using default rules
The example shows a request to allocate three consignments via default rules.
Allocate Using Default Rules Request
PUT https://api.electioapp.com/allocation/allocate
{
"ConsignmentReferences": [
"EC-000-05B-MMA",
"EC-000-083-45D",
"EC-000-A04-0DV"
]
}
Allocating a single consignment
The Allocate Consignment endpoint allocates a single package to the cheapest eligible carrier service. To call Allocate Consignment, send a PUT
request to https://api.electioapp.com/allocation/{consignmentReference}/allocatewithcheapestquote
, where {consignmentReference}
refers to the consignment you want to allocate.
Once the request has been received, Consignments uses the process detailed in the Overview header to determine the appropriate service and allocate the consignment. It then returns an Allocation Summary.
Example
The example shows a request to allocate a package with a {consignmentReference}
of EC-000-05A-Z6S via the Allocate Consignment endpoint.
PUT https://api.electioapp.com/allocation/EC-000-05A-Z6S/allocatewithcheapestquote
For full reference information on the Allocate Consignment endpoint, see the Allocate Consignment page of the API reference.