/materials/{materialId}
Deprecated
This endpoint allows you to update a specific material.
updateMaterial
| Name | Type | Description |
|---|---|---|
materialId
required
|
string |
The Material ID |
Content-Type: application/json
· Required fields: _type
_type
string
required
Type of the material
FOLDER
MATERIAL
name
string
Name of the material
Example: Chair
code
string
Code of the material. It must be unique
Example: CH-0001
observation
string
Description of the material
Example: This is a chair
mean_price
number
The mean price of the item. Used only when `_type` is "MATERIAL"
Example: 10.5
units
string
What unit should this item be measured with. Required if `_type` is "MATERIAL"
Example: un
material_warehouse
array<object>
Minimum Stock and other information of the material. This field is of type array and can contain multiple material_warehouse objects containing "warehouse_id" (required), "min_stock" (greater than 0) and "mean_price"
warehouse_id
integer
ID of the associated warehouse
min_stock
number
Minimum quantity of the material defined for this warehouse.
mean_price
number
Mean price of the material defined for this warehouse.
observation
string
An observation for the material in this specific warehouse.
parent_id
integer
The id of the parent folder for this item. Required if `_type` is "MATERIAL"
default_sell_price
number
The default sell price for this item.
default_sell_vat
number
The default sell VAT for this item.
data
object
Material model structure details
id
string
required
read-only
ID of the Material
Example: 1
type
string
required
read-only
Model type
material
Example: material
attributes
object
required
material_id
integer
read-only
ID of the material
Example: 1
parent_id
integer
read-only
ID of the associated folder of the material
Example: 1
name
string
Name of the material
Example: Chair
code
string
Code of the material
Example: CH-00001
full_code
string
read-only
Full code of the material (folders prefix included)
Example: FOLDER.CH-00001
observations
string | null
Material observations
Example: This is a observation
is_real
boolean
Indicates if this is a real material or a parent folder of materials
Example: 1
units
string
Indicates which kind of unit should this material be measured with
Example: un
mean_price
object
Mean price of the material
Example: 8
has_children
boolean
Indicates if this material is a parent of other materials
Example: 1
default_sell_price
number
The default sell price of the material
Example: 10
default_sell_vat
number
The default sell VAT of the material
Example: 23
is_from_network
boolean
Indicates if the material was shared via Infraspeak Network
Example:
purchase_consumption_type
string
Purchase consumption type of the material
INHERIT
AUTOMATIC
MANUAL
Example: INHERIT
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/materials/{materialId}' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-d '{
"_type": "",
"name": "Chair",
"code": "CH-0001",
"observation": "This is a chair",
"mean_price": 10.5,
"units": "un",
"material_warehouse": [],
"parent_id": 0,
"default_sell_price": 0,
"default_sell_vat": 0
}'
const response = await fetch('https://api.sandbox.infraspeak.com/v3/materials/{materialId}', {
method: 'PATCH',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
"_type": "",
"name": "Chair",
"code": "CH-0001",
"observation": "This is a chair",
"mean_price": 10.5,
"units": "un",
"material_warehouse": [],
"parent_id": 0,
"default_sell_price": 0,
"default_sell_vat": 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/materials/{materialId}',
array (
'_type' => '',
'name' => 'Chair',
'code' => 'CH-0001',
'observation' => 'This is a chair',
'mean_price' => 10.5,
'units' => 'un',
'material_warehouse' =>
array (
),
'parent_id' => 0,
'default_sell_price' => 0,
'default_sell_vat' => 0,
)
);
import requests
response = requests.patch(
'https://api.sandbox.infraspeak.com/v3/materials/{materialId}',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
json={
{
"_type": "",
"name": "Chair",
"code": "CH-0001",
"observation": "This is a chair",
"mean_price": 10.5,
"units": "un",
"material_warehouse": [],
"parent_id": 0,
"default_sell_price": 0,
"default_sell_vat": 0
}
},
)
data = response.json()