curl --request PUT \
--url https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"quantity": 2,
"unit_cost": 123,
"vat_rate": 50
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}"
payload = {
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"quantity": 2,
"unit_cost": 123,
"vat_rate": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stockable_id: '<string>',
stockable_unit_id: '<string>',
quantity: 2,
unit_cost: 123,
vat_rate: 50
})
};
fetch('https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}', 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/purchases/{purchase}/items/{item}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'stockable_id' => '<string>',
'stockable_unit_id' => '<string>',
'quantity' => 2,
'unit_cost' => 123,
'vat_rate' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}"
payload := strings.NewReader("{\n \"stockable_id\": \"<string>\",\n \"stockable_unit_id\": \"<string>\",\n \"quantity\": 2,\n \"unit_cost\": 123,\n \"vat_rate\": 50\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stockable_id\": \"<string>\",\n \"stockable_unit_id\": \"<string>\",\n \"quantity\": 2,\n \"unit_cost\": 123,\n \"vat_rate\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"stockable_id\": \"<string>\",\n \"stockable_unit_id\": \"<string>\",\n \"quantity\": 2,\n \"unit_cost\": 123,\n \"vat_rate\": 50\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"stockable": {},
"stockable_unit": {},
"quantity": 123,
"remaining": 123,
"unit_cost": 123,
"vat_rate": "<string>",
"vat_total": 123,
"unit_cost_ttc": 123,
"cost_total": 123,
"cost_total_ttc": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}Edit a purchase line
Changes the product, unit, quantity or cost of a line on an editable purchase.
curl --request PUT \
--url https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"quantity": 2,
"unit_cost": 123,
"vat_rate": 50
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}"
payload = {
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"quantity": 2,
"unit_cost": 123,
"vat_rate": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stockable_id: '<string>',
stockable_unit_id: '<string>',
quantity: 2,
unit_cost: 123,
vat_rate: 50
})
};
fetch('https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}', 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/purchases/{purchase}/items/{item}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'stockable_id' => '<string>',
'stockable_unit_id' => '<string>',
'quantity' => 2,
'unit_cost' => 123,
'vat_rate' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}"
payload := strings.NewReader("{\n \"stockable_id\": \"<string>\",\n \"stockable_unit_id\": \"<string>\",\n \"quantity\": 2,\n \"unit_cost\": 123,\n \"vat_rate\": 50\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stockable_id\": \"<string>\",\n \"stockable_unit_id\": \"<string>\",\n \"quantity\": 2,\n \"unit_cost\": 123,\n \"vat_rate\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchases/{purchase}/items/{item}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"stockable_id\": \"<string>\",\n \"stockable_unit_id\": \"<string>\",\n \"quantity\": 2,\n \"unit_cost\": 123,\n \"vat_rate\": 50\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"stockable": {},
"stockable_unit": {},
"quantity": 123,
"remaining": 123,
"unit_cost": 123,
"vat_rate": "<string>",
"vat_total": 123,
"unit_cost_ttc": 123,
"cost_total": 123,
"cost_total_ttc": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}purchases.update, purchase_items.update
Conditions
- The purchase must be in draft or rejected status.
- quantity, when sent, must be an integer of at least 1.
- stockable_id and stockable_unit_id must be sent together; the unit must exist in the organization, belong to the item, be active, belong to a product variant and not be archived.
- The unit cannot be the unit of another line of the same purchase.
- unit_cost and vat_rate are refused when the purchase uses a single total cost (cost strategy total); under the unit strategy a sent unit_cost replaces the stored one.
- When the resulting purchase has VAT greater than zero, vat_is_recoverable must have been set; otherwise the call is refused with a validation error.
- Changing quantity also resets remaining to the new quantity.
- Recalculates the purchase totals (cost_total, vat_total, invoice_total, cost_leftover) and the unit_cost_ttc of every line.
- No stock movement or accounting entry is created.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the purchase that owns the line.
Identifier of the purchase line to change.
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, purchase_id, stockable_id, stockable_unit_id, quantity, remaining, unit_cost, vat_rate, vat_total, unit_cost_ttc, cost_total, cost_total_ttc, 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: stockable, stockable.vat_rate, stockable.taxes, stockable.units, stockableUnit, stockableUnit.uomUnit, stockableUnit.prices, stockableUnit.stockable.
Body
New item (product variant) of the line; 27 characters. Required together with stockable_unit_id.
27New item unit of the line; 27 characters. Required together with stockable_id and must not be the unit of another line of the purchase.
27New quantity, an integer of at least 1. Resets remaining to this quantity.
x >= 1New cost of one unit before VAT, in major units, greater than 0. Refused when the purchase has a single total cost.
New VAT rate in percent, from 0 to 100 with up to four decimals. Refused when the purchase has a single total cost; when omitted under the unit strategy the stored rate is kept.
0 <= x <= 100Response
Resource (only with response=resource).
Identifier of the purchase line (27-character KSUID).
Identifier of the purchase the line belongs to.
Identifier of the item (product variant) bought.
Identifier of the item unit (unit of measure) bought; unique within a purchase.
The item bought. Present only when requested with include=stockable.
The unit of the line. Present only when requested with include=stockableUnit.
Quantity bought, in the line's unit.
Quantity not yet received. Starts equal to quantity and is reset to quantity when the line is edited.
Cost of one unit before VAT. 0 under the total cost strategy, where costs are not entered per line. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).
VAT rate in percent with four decimals (for example "18.0000"); null under the total cost strategy.
VAT of the line (unit cost times quantity times rate, rounded half up). Null under the total cost strategy. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).
Cost of one unit including VAT; under the total strategy the invoice total divided by the total quantity (integer division). In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).
Cost of the line before VAT (unit cost times quantity). Null under the total cost strategy. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).
Cost of the line including VAT. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).