/categories
This endpoint allows you to create a Category.
createCategory
Content-Type: application/json
· Required fields: type, name, code, is_real
type
string
required
The Category type. A "TYPE_OF_EQUIPMENT" Category is directly related to equipments (e.g. a fridge) and a Category "SOFT_MAINTENANCE" is related to Locations (E.g. hotel rooms).
TYPE_OF_EQUIPMENT
SOFT_MAINTENANCE
Example: TYPE_OF_EQUIPMENT
code
string
required
Category code. Must be unique across the same "level".
Example: VENT
is_real
boolean
required
Whether the Category is "folder-like" (false) or a final category (true). Required if `type` is "TYPE_OF_EQUIPMENT".
Example: 1
name
string
required
Category name. Must be unique across the same "level".
Example: Ventilation
parent_id
integer | null
Parent ID of Category. Required if `is_real` is "true".
Example: 123
data
object
Category model structure details
id
string
required
read-only
ID of the Category
Example: 123
type
string
required
read-only
Model type
category
Example: category
attributes
object
required
category_id
integer
read-only
ID of the Category
Example: 123
type
string
The Category type. A "TYPE_OF_EQUIPMENT" Category is directly related to equipments (e.g. a fridge) and a Category "SOFT_MAINTENANCE" is related to Locations (E.g. hotel rooms).
SOFT_MAINTENANCE
TYPE_OF_EQUIPMENT
Example: SOFT_MAINTENANCE
all_technical_skills
boolean | null
Indicates if this category is associated to all technical skills.
Example: 1
code
string
Code of the Category.
Example: VENT
entity_id
integer
Entity ID of the Category.
Example: 123
full_code
string | null
read-only
Codes of the category's parents concatenated by dot with category code.
Example: XYZ.VENT
has_children
boolean
read-only
Whether the category has subitems or not.
Example: 1
is_real
boolean | null
Whether the category is a folder (false) or "final" category (true).
Example: 1
name
string
Name of the Category.
Example: Ventilation
parent_id
integer | null
ID of the category parent.
Example: 123
relationships
object
Available relationships of the Category.
categoryMeterings
object
Category Meterings associated to the category.
characteristics
object
Characteristics associated to the category.
entity
object
Entity associated to the category.
files
object
Files associated to the category.
maintenanceProcedures
object
Maintenance Procedures associated to the category.
maintenancePolicies
object
Maintenance Policies associated to the category.
problems
object
Problems associated to the category.
technicalSkills
object
Technical Skills associated to the category.
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
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 POST \
'https://api.sandbox.infraspeak.com/v3/categories' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-d '{
"type": "TYPE_OF_EQUIPMENT",
"code": "VENT",
"is_real": true,
"name": "Ventilation",
"parent_id": 123
}'
const response = await fetch('https://api.sandbox.infraspeak.com/v3/categories', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
"type": "TYPE_OF_EQUIPMENT",
"code": "VENT",
"is_real": true,
"name": "Ventilation",
"parent_id": 123
}),
});
const data = await response.json();
$response = Http::withHeaders([
'Accept' => 'application/json',
'Content-Type' => 'application/json',
])->withToken('YOUR_API_TOKEN')
->post('https://api.sandbox.infraspeak.com/v3/categories',
array (
'type' => 'TYPE_OF_EQUIPMENT',
'code' => 'VENT',
'is_real' => true,
'name' => 'Ventilation',
'parent_id' => 123,
)
);
import requests
response = requests.post(
'https://api.sandbox.infraspeak.com/v3/categories',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
json={
{
"type": "TYPE_OF_EQUIPMENT",
"code": "VENT",
"is_real": true,
"name": "Ventilation",
"parent_id": 123
}
},
)
data = response.json()