curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-deliveries \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-deliveries"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/purchase-deliveries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/catalog/purchase-deliveries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchase-deliveries"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/catalog/purchase-deliveries")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-deliveries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"purchase_id": "<string>",
"cash_register_id": "<string>",
"reference": "<string>",
"status": "<string>",
"additional_cost_strategy": "<string>",
"delivery_rate_id": "<string>",
"delivery_fee": 123,
"delivery_fee_label": "<string>",
"delivery_fee_paid_by_company": true,
"purchase_cost_leftover": 123,
"received_at": "2023-11-07T05:31:56Z",
"expected_at": "2023-12-25",
"notes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>",
"costs": "<array>"
}{
"message": "<string>",
"errors": {}
}Create a purchase delivery
Plans a delivery (goods brought by the supplier) against an active purchase, with items, extra costs, and an optional delivery fee.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-deliveries \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-deliveries"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/purchase-deliveries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/catalog/purchase-deliveries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchase-deliveries"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/catalog/purchase-deliveries")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-deliveries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"purchase_id": "<string>",
"cash_register_id": "<string>",
"reference": "<string>",
"status": "<string>",
"additional_cost_strategy": "<string>",
"delivery_rate_id": "<string>",
"delivery_fee": 123,
"delivery_fee_label": "<string>",
"delivery_fee_paid_by_company": true,
"purchase_cost_leftover": 123,
"received_at": "2023-11-07T05:31:56Z",
"expected_at": "2023-12-25",
"notes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>",
"costs": "<array>"
}{
"message": "<string>",
"errors": {}
}purchase_deliveries.create
Conditions
- The purchase must have the status pending; any other status is refused with 409 (a pending purchase is one whose supplier invoice is recognized).
- purchase_id and additional_cost_strategy are required; additional_cost_strategy is average or prorata.
- reference, when sent, must not already be used by another reception of the company (pickups and deliveries share the same references).
- cash_register_id, when sent, must be a cash register of the company that has a cash account.
- items, when sent, must hold at least one line and each line follows the delivery/pickup line rules (see the line endpoints); item_id values must be distinct inside the request.
- Each costs entry needs a key (up to 250 characters) and a value of 0 or more, in major units with at most the currency’s decimals.
- recoverable_vat_total and vat_total are refused: supplier invoice tax belongs to the purchase, not to the reception.
- asset_id must be an existing, active location asset available to the current company and not restricted for the current member; otherwise the call is refused with 422.
- item_id must be a line of the purchase this reception belongs to; a line of another purchase is refused with 422.
- The purchase unit of the line must still be active.
- quantity must be greater than 0 and may not exceed the quantity still to receive on that purchase line. Quantities of other draft receptions are not reserved, so the same remainder can be planned twice and is only enforced again at confirmation.
- A purchase line can appear only once per reception (item_id is unique inside the reception; deleted lines are really removed, so they no longer count).
- damaged_quantity is counted in the damage unit (the purchase unit when damage_stockable_unit_id is omitted) and must be between 0 and the received quantity expressed in that unit; the received quantity must convert exactly into that unit.
- damage_stockable_unit_id, when sent, must be an active unit of the same product and the same unit category as the purchase line.
- damage_reason, damage_cost_treatment and damage_stockable_unit_id are refused when damaged_quantity is 0; damage_reason and damage_cost_treatment are required when damaged_quantity is above 0.
- damage_cost_treatment “absorbed_by_remaining_stock” is refused when every received unit is damaged, because no accepted stock would remain to absorb the cost.
- cost_total cannot be sent; it is computed by the server.
- delivery_rate_id, when sent, must be an active delivery rate of the same supplier as the purchase.
- delivery_fee and delivery_fee_label are refused when delivery_rate_id is sent: a delivery uses either a predefined rate or a custom fee. Sending neither means a free delivery. delivery_fee is in major units, 0 or more.
- delivery_fee_paid_by_company defaults to true when omitted.
- Nested lines accept asset_id, item_id, quantity, damaged_quantity, damage_reason and damage_cost_treatment; damage_stockable_unit_id is also accepted.
- Creates the delivery in the draft status with received_at empty and purchase_cost_leftover at 0.
- Copies the chosen delivery rate’s amount and label into the delivery as a snapshot; later changes to the rate do not change it.
- Creates the nested items and costs when they are sent. Nothing is added to stock and the purchase is not changed.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource Comma-separated JSON keys of the root resource (id is always rendered). Available: id, type, purchase_id, cash_register_id, reference, status, additional_cost_strategy, delivery_rate_id, delivery_fee, delivery_fee_label, delivery_fee_paid_by_company, purchase_cost_leftover, received_at, expected_at, notes, created_at, updated_at.
Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: items, items.item, items.damageStockableUnit, costs.
Response
Resource (only with response=resource).
Identifier of the reception (27-character KSUID).
Kind of reception: "delivery" here. Set by the server from the route.
Identifier of the purchase this reception brings goods for. Set at creation and not changeable.
Cash register recorded on the reception, or null. It must belong to the current company and organization and have a cash account. It is only stored.
Optional free reference, unique among the company's receptions (pickups and deliveries together). Null when none.
State of the reception: draft (being prepared), in_transit (deliveries only: the supplier's truck is on its way, still editable) or confirmed (goods received, stock added). Set by the server.
How the extra costs are spread over the lines at confirmation: average (equally) or prorata (in proportion to each line's base cost).
Identifier of the supplier's predefined delivery rate the fee was copied from, or null for a custom fee or a free delivery.
Delivery fee in major units, copied from the rate or entered as a custom fee. Null when the delivery is free. It is added to the landed cost spread over the lines at confirmation.
Label of the delivery fee (copied from the rate, or custom), or null.
true (default) when the company pays the fee itself; false when the fee is owed to the supplier and added to the purchase's payable once the delivery is confirmed.
Rounding leftover of the purchase's cost that was added to this reception's lines at confirmation, in major units. 0 until the reception is confirmed.
Date and time of confirmation (ISO 8601). Null until the reception is confirmed.
Date the goods are expected (YYYY-MM-DD), or null.
Free notes, or null.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Lines of the reception. Present only when requested with include=items.
Extra costs of the reception. Present only when requested with include=costs.