Invoiced Routes API¶
Summary¶
| Resource | Operation | Description |
|---|---|---|
| Invoiced Routes | POST /dcs/(dc_id)/invoiced-routes | Add an importable invoiced route |
Details¶
-
POST/dcs/(dc_id)/invoiced-routes¶ This endpoint is asynchronous and will return a transaction id to be used to check the route import status.
Parameters: - dc_id (string) – The dc id
Request JSON Object: - route (json) – The invoiced route to be imported. See import invoiced route model
Status Codes: - 202 Accepted – The request to import an Invoiced Route has been accepted. The returned txid should be used to poll for the route import status.
- 400 Bad Request – Check error code within the response.
- 401 Unauthorized – API key is invalid.
- 403 Forbidden – DC does not exist or user does not have permission to access it.
Status 400 error codes
Error Code Description 3005 Cannot import another route with the same id. 3006 Cannot import another waypoint with the same id. 3008 Cannot import another invoice with the same id. 3009 Cannot import another invoice item with the same id. Example request
{ "route": { "id": "globally unique route id", "name": "name", "driver_id": "driver id", "start_time": 1510860915000, "activate_after_successful_import": true, "start_warehouse": { "id": "warehouse id", "name": "warehouse name", "address": "physical address", "location": { "latitude": 3.0, "longitude": 4.0 } }, "end_warehouse": { "id": "warehouse id", "name": "warehouse name", "address": "physical address", "location": { "latitude": 3.0, "longitude": 4.0 } }, "vehicle": { "id": "globally unique vehicle id" }, "waypoints": [{ "id": "globally unique waypoint id", "customer_id": "customer id", "name": "waypoint name", "address": "physical address", "location": { "latitude": 1.0, "longitude": 2.0 }, "service_time_minutes": 999, "time_windows": [{ "start": 1510864915000, "end": 1510868515000 }], "invoices": [{ "id": "invoice A", "payment_method": "CASH", "invoice_name_attributes": [{"key": "key1", "value": "value2"}], "items": [{ "id": "item A", "sku": "sku A", "name": "name A", "quantity": 123.0, "display_unit_of_measure": "bottles", "total_price_cents": 9999, "currency": "USD" }] }] }, { "id": "globally unique waypoint id", "customer_id": "customer id", "name": "waypoint name", "address": "physical address", "location": { "latitude": 3.0, "longitude": 4.0 }, "service_time_minutes": 999, "time_windows": [], "invoices": [{ "id": "invoice B", "payment_method": "CASH", "invoice_name_attributes": [{"key": "key1", "value": "value2"}], "items": [{ "id": "item B", "sku": "sku B", "name": "name B", "quantity": 123.0, "display_unit_of_measure": "cases", "total_price_cents": 9999, "currency": "USD" }] }] } ] } }
Example successful response
{ "status": "success", "data": { "txid": "the transaction id" } }
Example error response
{ "data": { "code": 3006, "message": "Cannot import another waypoint with the same id" }, "status": "error" }