HubRise
menu
HubRise
closeHubRise

Référence API

Cette documentation est disponible en anglais uniquement.

Deliveries

HubRise offers two complementary resources to manage order deliveries:

  • Delivery quotes enable third-party services to provide cost estimates and delivery timeframes.

  • Deliveries represent the actual fulfillment process. They contain real-time tracking information including the estimated and actual pickup and drop-off times, driver details, and current delivery status.

While an order can have multiple delivery quotes, only a single delivery can be created and tracked per order.

The most general workflow is as follows - in scenarios with a single provider, a delivery may be created directly without quotes:

  • An order is created, and sent to one or several delivery quote providers.
  • Each provider creates a delivery quote for the order.
  • The business or customer accepts one of the quotes.
  • The provider whose quote was accepted creates a delivery for the order.
  • The provider updates the delivery status as the order is picked up and delivered.

Delivery Quotes

1. Create a Delivery Quote

Creates a delivery quote for an order.

Endpoint:
POST /locations/:location_id/orders/:order_id/delivery_quotes
Short endpoint:
POST /location/orders/:order_id/delivery_quotes (location only)
Access level:
Location, Account

This endpoint can only be called for orders whose service_type is set to delivery.

Parameters:
NameTypeDescription
carrierstringThe name of the carrier.
carrier_ref optionalstringA ref code that identifies the carrier.
ref optionalstringThe carrier's identifier of the quote.
feestringThe quoted delivery fee.
estimated_pickup_at optionalTimeThe estimated pickup time.
estimated_dropoff_at optionalTimeThe estimated drop-off time.
Example request

POST /location/orders/5dpm9/delivery_quotes

{ "carrier": "UPS", "carrier_ref": "ups", "ref": "1Z12345E0291980793", "status": "pending", "fee": "4.50 EUR", "estimated_pickup_at": "2023-01-01T12:00:00+01:00", "estimated_dropoff_at": "2023-01-01T12:30:00+01:00"}

2. Accept a Delivery Quote

Marks a delivery quote as accepted, and saves the acceptance time.

This action is not reversible, and will usually result in the creation of a delivery by the carrier. Several quotes can be accepted for the same order, for example if the first carrier does not create a delivery in time.

Endpoint:
POST /locations/:location_id/orders/:order_id/delivery_quotes/:id/accept
Short endpoint:
POST /location/orders/:order_id/delivery_quotes/:id/accept (location only)
Access level:
Location, Account
Example request

POST /location/orders/5dpm9/delivery_quotes/ez351/accept

3. Retrieve Delivery Quote

Retrieves a delivery quote attached to an order.

Endpoint:
GET /locations/:location_id/orders/:order_id/delivery_quotes/:id
Short endpoint:
GET /location/orders/:order_id/delivery_quotes/:id (location only)
Access level:
Location, Account

All the fields of a delivery quote creation request are returned, plus a few more:

NameTypeDescription
idstringThe id of the delivery quote.
order_idstringThe id of the order.
location_idstringThe id of the location.
accepted_at optionalTimeTime the quote was accepted by the customer or the business, or null if it has not been accepted.
Example request

GET /location/orders/5dpm9/delivery_quotes/ez351

Response:
{ "id": "ez351", "order_id": "5dpm9", "location_id": "3r4s3-1", "carrier": "UPS", "carrier_ref": "ups", "ref": "Q12345E029198"; "fee": "4.50 EUR", "estimated_pickup_at": "2023-01-01T12:17:00+01:00", "estimated_dropoff_at": null, "accepted_at": "2023-01-01T11:45:00+01:00"}

4. List Delivery Quotes

Returns the delivery quotes attached to an order.

Endpoint:
GET /locations/:location_id/orders/:order_id/delivery_quotes
Short endpoint:
GET /location/orders/:order_id/delivery_quotes (location only)
Access level:
Location, Account
Example request

GET /location/orders/5dpm9/delivery_quotes

[ { "id": "ez351", "order_id": "5dpm9", "location_id": "3r4s3-1", "carrier": "UPS", "carrier_ref": "ups", "ref": "Q12345E029198"; "fee": "4.50 EUR", "estimated_pickup_at": "2023-01-01T12:17:00+01:00", "estimated_dropoff_at": null, "accepted_at": "2023-01-01T11:45:00+01:00" }, { "id": "a5z32", "order_id": "5dpm9", "location_id": "3r4s3-1", "carrier": "FedEx", "carrier_ref": "fedex", "ref": "FQ6678136645"; "fee": "6.50 EUR", "estimated_pickup_at": "2023-01-01T12:10:00+01:00", "estimated_dropoff_at": "2023-01-01T12:40:00+01:00", "accepted_at": null }]

Deliveries

1. Create a Delivery

Attaches a delivery to an order.

Endpoint:
POST /locations/:location_id/orders/:order_id/delivery
Short endpoint:
POST /location/orders/:order_id/delivery (location only)
Access level:
Location, Account

This endpoint can only be called if:

  • The order has no delivery yet.
  • The order's service_type is set to delivery.
Parameters:
NameTypeDescription
carrierstringThe name of the carrier.
carrier_ref optionalstringA ref code that identifies the carrier.
ref optionalstringThe carrier's identifier of the delivery, such as a tracking number.
statusstringThe delivery status. See Delivery Statuses.
fee optionalstringThe delivery fee charged by the carrier to the business.
estimated_pickup_at optionalTimeThe pickup time, estimated by the carrier.
estimated_dropoff_at optionalTimeThe drop-off time, estimated by the carrier.
tracking_url optionalstringURL where the customer can track the delivery status, the driver position, or both.
driver_name optionalstringThe driver name.
driver_phone optionalstringThe driver phone number.
driver_phone_access_code optionalstringThe access code to provide when calling the phone number above.
driver_latitude optionaldecimalThe current latitude of the driver.
driver_longitude optionaldecimalThe current longitude of the driver.
assigned_at optionalTimeTime the status changed to pickup_enroute.
pickup_at optionalTimeTime the status changed to dropoff_enroute.
delivered_at optionalTimeTime the status changed to delivered.
cancelled_at optionalTimeTime the status changed to cancelled.
driver_position_updated_at optionalTimeTime the driver's position was last updated.
Example request

POST /location/orders/5dpm9/delivery

{ "carrier": "UPS", "carrier_ref": "ups", "ref": "1Z12345E0291980793", "status": "pending", "fee": "4.50 EUR", "estimated_pickup_at": "2023-01-01T12:00:00+01:00", "estimated_dropoff_at": "2023-01-01T12:30:00+01:00", "tracking_url": "https://www.ups.com/track/1Z12345E0291980793", "driver_name": "John", "driver_phone": "+33612345678", "driver_phone_access_code": "1234", "driver_latitude": "48.856614", "driver_longitude": "2.3522219"}

Delivery statuses

The following statuses are available:

StatusDescription
pendingNot started
pickup_enrouteEn route to pickup
pickup_approachingNearing pickup
pickup_waitingAt pickup
dropoff_enrouteEn route to dropoff
dropoff_approachingNearing dropoff
dropoff_waitingAt dropoff
deliveredCompleted
cancelledCancelled

2. Retrieve a Delivery

Retrieves the delivery attached to an order.

Endpoint:
GET /locations/:location_id/orders/:order_id/delivery
Short endpoint:
GET /location/orders/:order_id/delivery (location only)
Access level:
Location, Account

If the order has no delivery, a 404 - Not Found error is returned.

Example request

GET /location/orders/5dpm9/delivery

{ "id": "ez351", "order_id": "5dpm9", "location_id": "3r4s3-1", "carrier": "UPS", "carrier_ref": "ups", "ref": "1Z12345E0291980793", "status": "pickup_waiting", "fee": "4.50 EUR", "estimated_pickup_at": "2023-01-01T12:17:00+01:00", "estimated_dropoff_at": "2023-01-01T12:29:00+01:00", "tracking_url": "https://www.ups.com/track?tracknum=1Z12345E0291980793", "driver_name": "John", "driver_phone": "+33612345678", "driver_phone_access_code": "1234", "driver_latitude": "48.856702", "driver_longitude": "2.35222", "assigned_at": "2023-01-01T12:11:03+01:00", "pickup_at": null, "delivered_at": null, "cancelled_at": null, "driver_position_updated_at": "2023-01-01T12:20:15+01:00"}

3. Update a Delivery

Updates the delivery attached to an order.

Endpoint:
PATCH /locations/:location_id/orders/:order_id/delivery
Short endpoint:
PATCH /location/orders/:order_id/delivery (location only)
Access level:
Location, Account

All fields can be updated, except: carrier, carrier_ref, fee.

If the order has no delivery, a 404 - Not Found error is returned.

Example request

PATCH /location/orders/5dpm9/delivery

{ "driver_latitude": "48.856614", "driver_longitude": "2.3522219"}

Auto-updated fields

The following fields are updated automatically when the delivery status changes:

StatusField
pickup_enrouteassigned_at
dropoff_enroutepickup_at
delivereddelivered_at
cancelledcancelled_at

Additionally, the driver_position_updated_at field is updated whenever the driver's latitude or longitude is included in an update, no matter whether those values changed.

You can manually override all these fields if required. This can be useful for skipped updates.

Commentaires sur cette page