/stocks/{stock}
Deprecated
This endpoint allows you to update a specific Stock.
A stock represents a quantity of material that it is available in a warehouse that can be consumed, moved or added. A stock is always associated with a stock movement.
updateStock
| Name | Type | Description |
|---|---|---|
stock
required
|
string |
The stock ID |
Content-Type: application/json
material_id
integer
ID of the material associated with the stock
Example: 1
quantity
number
Quantity of the material associated with the stock
Example: 50
warehouse_id
integer
The ID of the warehouse associated with the stock
Example: 1
failure_id
integer
The ID of the failure associated with the stock
Example: 1
schedule_work_id
integer
The ID of the schedule work associated with the stock
Example: 1
mean_price
number
The mean price of the material associated with the stock
Example: 10
data
object
Stock model structure details
id
string
required
read-only
ID of the Stock
type
string
required
read-only
Model type
stock
attributes
object
required
stock_id
integer
read-only
ID of the Stock
Example: 1
stock_movement_id
integer | null
read-only
ID of the last Stock Movement of the Stock
Example: 1
action
string | null
read-only
Action performed for the stock
warehouse_id
integer | null
read-only
ID of the warehouse associated with the stock
material_id
integer
read-only
ID of the material associated with the stock
quantity
number
read-only
Quantity of the material present in the stock
mean_price
number | null
read-only
Mean price of the material associated with the stock
observation
string | null
read-only
Description or notes of the stock
date
string (date-time) | null
read-only
Example: 2020-08-28 17:12:00
failure_id
integer | null
read-only
ID of the failure associated with the stock
schedule_work_id
integer | null
read-only
ID of the schedule work associated with this stock
mean_price_manually_updated
boolean
read-only
Mean price of the stock (if it was manually updated)
date_updated
string (date-time) | null
read-only
Example: 2020-08-28 17:12:00
destination_id
integer
read-only
ID of the destination warehouse of the stock. Only present if the stock action is "MOVED_FROM"
source_id
integer
read-only
ID of the origin warehouse of the stock. Only present if the stock action is "MOVED_TO"
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
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/stocks/{stock}' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-d '{
"material_id": 1,
"quantity": 50,
"warehouse_id": 1,
"failure_id": 1,
"schedule_work_id": 1,
"mean_price": 10
}'
const response = await fetch('https://api.sandbox.infraspeak.com/v3/stocks/{stock}', {
method: 'PATCH',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
"material_id": 1,
"quantity": 50,
"warehouse_id": 1,
"failure_id": 1,
"schedule_work_id": 1,
"mean_price": 10
}),
});
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/stocks/{stock}',
array (
'material_id' => 1,
'quantity' => 50,
'warehouse_id' => 1,
'failure_id' => 1,
'schedule_work_id' => 1,
'mean_price' => 10,
)
);
import requests
response = requests.patch(
'https://api.sandbox.infraspeak.com/v3/stocks/{stock}',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
json={
{
"material_id": 1,
"quantity": 50,
"warehouse_id": 1,
"failure_id": 1,
"schedule_work_id": 1,
"mean_price": 10
}
},
)
data = response.json()