/sales/buy-orders/{buy-order-id}
This endpoint allows you to update a Buy Order.
updateBuyOrder
| Name | Type | Description |
|---|---|---|
buy-order-id
required
|
string |
The Buy Order ID |
Content-Type: application/json
supplier_id
integer | null
ID of the supplier associated with the Buy Order. Nullable only if state is 'SAVED_AS_DRAFT'.
warehouse_id
integer
ID of the Warehouse associated to the Buy Order.
description
string | null
Observations/notes of the Buy Order.
internal_sale_id
string | null
Internal ID of the Buy Order.
external_sale_id
string | null
External ID of the Buy Order.
related_to_type
string | null
Type of object related to the Buy Order. Required with field related_to_id.
FAILURE
SCHEDULED_WORK
related_to_id
integer | null
ID of the object (failure or scheduled work) related to the Buy Order. Required with field related_to_type.
data
object
Buy Order model structure details
id
string
read-only
ID of the Buy Order.
type
string
read-only
Model type
buy_order
attributes
object
entity_id
integer
read-only
type
string
read-only
Type of Buy Order.
MATERIAL
SERVICE
base_total
string | null
read-only
The total base price of the Buy Order (including discount).
code
string
read-only
Code of the Buy Order.
completed_at
string | null
read-only
Date Buy Order is Received (state transition to 'RECEIVED').
Example: 2021-07-21 18:38:00
completed_by
integer | null
read-only
ID of the user who Received the Buy Order (state transition to 'RECEIVED').
created_by
integer | null
read-only
ID of the user who created the Buy Order
date_created
string | null
read-only
Date Buy Order is Created.
Example: 2021-07-21 18:38:00
date_updated
string
read-only
Date Buy Order was last updated.
Example: 2021-07-21 18:38:00
delivery_address
string | null
Delivery Address of the Buy Order.
discount_total
string | null
read-only
The total discount of the Buy Order.
external_buy_id
string | null
External ID of the Buy Order.
internal_buy_id
string | null
Internal ID of the Buy Order.
observation
string | null
Observations or notes of the Buy Order.
order_id
integer
read-only
ID of the Buy Order.
processed_at
string | null
read-only
Date Buy Order is started (state transition to 'CREATED').
Example: 2021-07-21 18:38:00
processed_by
integer | null
read-only
ID of the user who started the Buy Order (state transition to 'CREATED').
related_to_id
integer | null
ID of the object (failure or scheduled work) related to the Buy Order (required with field related_to_type).
related_to_type
string | null
Type of object related to the Buy Order (required with field related_to_id).
FAILURE
SCHEDULED_WORK
state
string
State of the Buy Order.
SAVED_AS_DRAFT
CREATED
RECEIVED_PARTIALLY
RECEIVED
CONFIRMED
Example: SAVED_AS_DRAFT
supplier_id
integer | null
ID of the Supplier associated to the Buy Order. Required for type 'SERVICE' and state is not 'SAVED_AS_DRAFT'.
total_price
number
read-only
The total price of the Sell Order (including VAT and discount)
vat_total
string | null
read-only
The total VAT of the Buy Order.
warehouse_id
integer | null
ID of the Warehouse associated to the Buy Order. Required for type 'MATERIAL' and state is not 'SAVED_AS_DRAFT'.
meta
object
custom_fields
object | null
meta
object
Meta model structure details
cost_centers
array<string>
Example: ["Cost center","Cost center 2"]
status
string
error
error
object
properties
object
Only present when related to property validation error
dev_message
string
Example: Property validation error. Check the "properties" section in the response.
http_code
integer
400
message
string
Example: Property validation error.
more_info
string
status
string
error
error
object
http_code
integer
401
message
string
Example: Authentication token invalid.
more_info
string
status
string
error
error
object
http_code
integer
403
message
string
Example: Action unauthorized
more_info
string
status
string
error
error
object
http_code
integer
404
message
string
Example: Resource not found
more_info
string | null
status
string
error
error
object
http_code
integer
429
message
string
Example: Too Many Requests.
more_info
string
status
string
error
error
object
http_code
integer
500
message
string
Example: An error has occurred during the request.
more_info
string
curl -X PATCH \
'https://api.sandbox.infraspeak.com/v3/sales/buy-orders/{buy-order-id}' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-d '{
"supplier_id": 0,
"warehouse_id": 0,
"description": "",
"internal_sale_id": "",
"external_sale_id": "",
"related_to_type": "",
"related_to_id": 0
}'
const response = await fetch('https://api.sandbox.infraspeak.com/v3/sales/buy-orders/{buy-order-id}', {
method: 'PATCH',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
"supplier_id": 0,
"warehouse_id": 0,
"description": "",
"internal_sale_id": "",
"external_sale_id": "",
"related_to_type": "",
"related_to_id": 0
}),
});
const data = await response.json();
$response = Http::withHeaders([
'Accept' => 'application/json',
'Content-Type' => 'application/json',
])->withToken('YOUR_API_TOKEN')
->patch('https://api.sandbox.infraspeak.com/v3/sales/buy-orders/{buy-order-id}',
array (
'supplier_id' => 0,
'warehouse_id' => 0,
'description' => '',
'internal_sale_id' => '',
'external_sale_id' => '',
'related_to_type' => '',
'related_to_id' => 0,
)
);
import requests
response = requests.patch(
'https://api.sandbox.infraspeak.com/v3/sales/buy-orders/{buy-order-id}',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
json={
{
"supplier_id": 0,
"warehouse_id": 0,
"description": "",
"internal_sale_id": "",
"external_sale_id": "",
"related_to_type": "",
"related_to_id": 0
}
},
)
data = response.json()