curl --request PUT \
--url https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/items/{item} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase_item_id": "<string>",
"quantity": 123,
"stockable_unit_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
]
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/items/{item}"
payload = {
"purchase_item_id": "<string>",
"quantity": 123,
"stockable_unit_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
]
}
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({
purchase_item_id: '<string>',
quantity: 123,
stockable_unit_id: '<string>',
stock_sources: [{quantity: 123, asset_id: '<string>', group_id: '<string>'}]
})
};
fetch('https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/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/purchase-returns/{purchase_return}/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([
'purchase_item_id' => '<string>',
'quantity' => 123,
'stockable_unit_id' => '<string>',
'stock_sources' => [
[
'quantity' => 123,
'asset_id' => '<string>',
'group_id' => '<string>'
]
]
]),
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/purchase-returns/{purchase_return}/items/{item}"
payload := strings.NewReader("{\n \"purchase_item_id\": \"<string>\",\n \"quantity\": 123,\n \"stockable_unit_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ]\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/purchase-returns/{purchase_return}/items/{item}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase_item_id\": \"<string>\",\n \"quantity\": 123,\n \"stockable_unit_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/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 \"purchase_item_id\": \"<string>\",\n \"quantity\": 123,\n \"stockable_unit_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"return_id": "<string>",
"purchase_item_id": "<string>",
"stockable_unit_id": "<string>",
"purchase_item": {},
"stockable_unit": {},
"stock_sources": [
"<unknown>"
],
"quantity": 123,
"cost_total": 123,
"stock_cost_total": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}Change a purchase return item
Changes the quantity, unit or stock sources of a line on a draft supplier return.
curl --request PUT \
--url https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/items/{item} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase_item_id": "<string>",
"quantity": 123,
"stockable_unit_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
]
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/items/{item}"
payload = {
"purchase_item_id": "<string>",
"quantity": 123,
"stockable_unit_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
]
}
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({
purchase_item_id: '<string>',
quantity: 123,
stockable_unit_id: '<string>',
stock_sources: [{quantity: 123, asset_id: '<string>', group_id: '<string>'}]
})
};
fetch('https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/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/purchase-returns/{purchase_return}/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([
'purchase_item_id' => '<string>',
'quantity' => 123,
'stockable_unit_id' => '<string>',
'stock_sources' => [
[
'quantity' => 123,
'asset_id' => '<string>',
'group_id' => '<string>'
]
]
]),
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/purchase-returns/{purchase_return}/items/{item}"
payload := strings.NewReader("{\n \"purchase_item_id\": \"<string>\",\n \"quantity\": 123,\n \"stockable_unit_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ]\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/purchase-returns/{purchase_return}/items/{item}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase_item_id\": \"<string>\",\n \"quantity\": 123,\n \"stockable_unit_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-returns/{purchase_return}/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 \"purchase_item_id\": \"<string>\",\n \"quantity\": 123,\n \"stockable_unit_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"return_id": "<string>",
"purchase_item_id": "<string>",
"stockable_unit_id": "<string>",
"purchase_item": {},
"stockable_unit": {},
"stock_sources": [
"<unknown>"
],
"quantity": 123,
"cost_total": 123,
"stock_cost_total": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}purchase_return_items.update, purchase_returns.update
Conditions
- Both purchase_return_items.update and purchase_returns.update are needed.
- The supplier return must still be a draft.
- purchase_item_id cannot be changed: it is refused.
- Omitted fields keep their current value, so changing the quantity without sending stock_sources re-checks the existing sources against the new quantity and refuses a mismatch.
- The quantity, unit and stock sources follow the same checks as when adding an item, counting the other returns of the purchase but not this line.
- Recomputes the cost_total of the line. Stock does not move until the return is confirmed.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the purchase return (27-character KSUID string).
Identifier of the supplier return item (27-character KSUID string).
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, return_id, purchase_item_id, stockable_unit_id, stock_sources, quantity, cost_total, stock_cost_total, 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: purchaseItem, purchaseItem.stockable, purchaseItem.stockableUnit, stockableUnit, stockableUnit.uomUnit, stockableUnit.prices, stockableUnit.stockable.
Body
Identifier of the purchase line to return (27-character KSUID string). Required when adding a line; it must belong to the return's purchase and appear only once on the return. Not accepted when changing a line.
Quantity to return, in the chosen unit, above zero. Required when adding a line. It cannot exceed what was received, accepted and not already returned.
Unit the quantity is expressed in. Must be an active unit of the same item and measurement category. Defaults to the unit of the purchase line when adding; when changing, omitting it keeps the current unit.
Stock the goods are taken from. Required for a stock-tracked item and refused for an untracked one. The quantities must add up to quantity. When changing a line, omitting it keeps the current sources.
Show child attributes
Show child attributes
Response
Resource (only with response=resource).
Identifier of the return line (27-character KSUID string).
Identifier of the supplier return the line belongs to.
Identifier of the purchase line being returned.
Identifier of the unit the quantity is expressed in; defaults to the unit of the purchase line.
The purchase line. Present only when requested with include=purchaseItem.
The unit of the quantity. Present only when requested with include=stockableUnit.
Where the goods are taken from: a list of {quantity, asset_id} or {quantity, group_id}. Empty for a line that is not stock-tracked.
Quantity returned, in the line's unit.
Commercial value of the returned quantity in major units (the minor-unit amount divided by 10 to the power currency_exponent), computed first-in-first-out from the received quantities. This is the amount that reduces the purchase balance when the return has a credit note.
Inventory cost of the stock that left when the return was confirmed in major units (the minor-unit amount divided by 10 to the power currency_exponent); null until confirmation and for lines that are not stock-tracked.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).