Managing Existing Orders
Need to make changes to an order before you pack it? This page explains how to retrieve and edit order details.
Retrieving Orders
The Get Order endpoint returns full current details for a specific order. To call Get Order, send a GET
request to https://api.electioapp.com/orders/{orderReference}
.
Note
For full reference information on the Get Order endpoint, see the API reference.
Example Get Order Call
The example below shows a Get Order request for a fairly simple order with an {orderReference}
of EO-000-002-K0R.
GET https://api.electioapp.com/orders/EO-000-002-K0R
Updating Order Details
The Update Order endpoint enables you to update an existing order. To call Update Order, send a PUT
request to https://api.electioapp.com/orders/{orderReference}
.
When you make an Update Order request for a particular order, SortedPRO overwrites the existing order's details with new details provided in the body of the request. The structure of the Update Order request is identical to that of the Create Order request.
PRO uses the following rules when updating order properties:
{OrderReference}
- Required property. Cannot be updated.{OrderReferenceProvidedByCustomer}
- PRO replaces the entire property with the updated values. If no value is provided, any existing value is deleted.{RequiredDeliveryDate}
- PRO replaces the entire property with the updated values. If no value is provided, any existing value is deleted.{Source}
- Ignored. Cannot be updated.{ShippingDate}
- PRO replaces the entire property with the updated values. If no value is provided, any existing value is deleted.{Packages}
- Ignored. Use the Pack Order endpoint to manage an order's packages instead.{CustomsDocumentation}
- PRO replaces the entire property with the updated values. If no value is provided, any existing value is deleted.{Addresses}
- If any values are provided, then PRO replaces the entire property with the updated values. If no values are provided, PRO makes no changes to the order.{MetaData}
- PRO replaces the entire property with the updated values. If no value is provided, any existing value is deleted.{Direction}
- If any values are provided, then PRO replaces the entire property with the updated values. If no values are provided, PRO makes no changes to the order.{Tags}
- If any values are provided, then PRO replaces the entire property with the updated values. If no values are provided, PRO makes no changes to the order.
Note
For full reference information on the Update Order endpoint, see the Update Order page of the API reference.
Once it has received the request, PRO updates the order and returns a code 200 message as confirmation.
Update Order Example
The example shows an Update Order request to update delivery and shipping dates on an order with an {orderReference}
of EO-000-002-K0R.
PUT https://api.electioapp.com/orders/EO-000-002-K0R
Adding and Updating Order Addresses
In addition to the Update Order endpoint, PRO also features specific endpoints for adding and updating the addresses on a consignment.
The Add Address To Order endpoint enables you to add a new address to an order. To call Add Address To Order, send a
POST
request tohttps://api.electioapp.com/orders/{orderReference}/address
.Add Address To Order can only be used to add addresses with an address type that does not already exist on the order. For example, suppose that you have an order that already has Origin and Destination addresses. You could use Add Address To Order to add a new Sender address to that order (because the order does not currently have a Sender address), but you could not use it to add a new Origin address (because the order does have an existing Origin).
The Update Address On Order endpoint enables you to update an existing address on an order. To call Update Address On Order, send a
PUT
request tohttps://api.electioapp.com/orders/{orderReference}/address
.Update Address On Order can only be used to edit addresses with an address type already exists on the order. For example, suppose that you have an order that already has Origin and Destination addresses. You could use Update Address On Order to edit those addresses (by using it to send a new
address
object with thatAddressType
), but not to add others of a different type.
For both of these endpoints, the body of the request should contain an address
object. The example below shows a new Sender address.
{
"AddressType": "Sender",
"Contact": {
"Title": "Mr",
"FirstName": "Peter",
"LastName": "McPetersson",
"Telephone": "07702123456",
"Mobile": "07702123456",
"LandLine": "0161544123",
"Email": "peter.mcpetersson@test.com"
},
"CompanyName": "Update Address On Order Ltd.",
"AddressLine1": "13 Porter Street",
"AddressLine2": "Pressington",
"AddressLine3": "Carlsby",
"Town": "Manchester",
"Region": "Greater Manchester",
"Postcode": "M1 5WG",
"Country": {
"Name": "Great Britain",
"IsoCode": {
"TwoLetterCode": "GB"
}
},
"SpecialInstructions": "Gate code: 4454",
"LatLong": {
"Latitude": 53.474220,
"Longitude": -2.246049
},
"IsCached": false
}
Both Add Address To Order and Update Address On Order return an empty code 200 message as confirmation that the address change was successful.
Note
- For full reference information on the Add Address To Order endpoint, see the Add Address To Order page of the API reference.
- For full reference information on the Update Address On Order endpoint, see the Update Address On Order page of the API reference.
Next Steps
- Learn how to pack orders into consignments at the Creating Consignments From Orders page.
- Learn how to retrieve delivery options at the Getting Delivery Options page.
- Learn how to allocate consignments at the Allocating Consignments page.