/other-costs
This endpoint allows you to create an Other Cost. Only users with the role "admin" or "manager" can perform this operation.
createOtherCost
Content-Type: application/json
· Required fields: name, input_type, failure, icon
name
string
required
The name (or description) of the Other Cost
Example: Contractual Labor
input_type
string
required
The type of Other Cost. Different types of Other Costs have different associated fields. Other Costs of type resource will measure its total cost based on how long (e.g. hours, minutes) the resource is occupied. Other Costs of type distance will measure its total cost based on how many units (e.g. meters, kilometers) are needed. Other Costs of type interval and time_range will measure its total cost based on duration. Other Costs of type currency will have a fixed cost manually defined for each operation. Other Costs of type custom_unit_of_measurement will measure its total cost based on how many units (e.g. m3, liters) are needed.
currency
distance
interval
time_range
resource
custom_unit_of_measurement
Example: currency
icon
string
required
The icon to be presented for the Other Cost in Infraspeak platform.
truck
car
clock-o
bed
user
usd
cutlery
wrench
Example: truck
failure
boolean
required
Indicates if the Other Cost can be included in costs for Corrective Maintenance (Work Orders).
Example: 1
schedule_work
boolean | null
Indicates if the Other Cost can be included in costs for Preventive Maintenance (Planned Job Orders).
Example: 1
operator
boolean | null
Indicates if the Other Cost can be included in individual costs for operators (technicians)
Example: 1
element
boolean | null
Indicates if the Other Cost can be included in costs for Assets
Example: 1
cost_per_unit
number | null
Cost per unit of the Other Cost. Only applicable if input_type is "resource", "distance" or "custom_unit_of_measurement"
default_sell_price
number | null
Default sell price of the Other Cost. Only applicable if input_type is "resource", "distance" or "custom_unit_of_measurement"
default_sell_vat
number | null
Default sale VAT/IVA percentage of the Other Cost. Only applicable if input_type is "resource", "distance" or "custom_unit_of_measurement"
unit
string | null
Unit of the Other Cost. Only applicable if input_type is "resource", "distance" or "custom_unit_of_measurement"
data
object
Other Cost model structure details
id
string
required
read-only
The ID of the Other Cost
Example: 123
type
string
required
read-only
Model type
other-cost
Example: other-cost
attributes
object
required
other_cost_id
integer
read-only
The ID of the Other Cost
Example: 123
entity_id
integer
read-only
The ID of the Entity
Example: 123
input_type
string
The type of Other Cost. Different types of Other Costs have different associated fields. Other Costs of type resource will measure its total cost based on how long (e.g. hours, minutes) the resource is occupied. Other Costs of type distance will measure its total cost based on how many units (e.g. meters, kilometers) are needed. Other Costs of type interval and time_range will measure its total cost based on duration. Other Costs of type currency will have a fixed cost manually defined for each operation. Other Costs of type custom_unit_of_measurement will measure its total cost based on how many units (e.g. m3, liters) are needed.
currency
distance
interval
time_range
resource
custom_unit_of_measurement
Example: currency
name
string
The name (or description) of the Other Cost
Example: Contractual Labor
failure
boolean
Indicates if the Other Cost can be included in costs for Corrective Maintenance (Work Orders)
Example: 1
schedule_work
boolean | null
Indicates if the Other Cost can be included in costs for Preventive Maintenance (Planned Job Orders)
Example: 1
operator
boolean | null
Indicates if the Other Cost can be included in individual costs for operators (technicians)
Example: 1
icon
string
The icon to be presented for the Other Cost in Infraspeak platform.
truck
car
clock-o
bed
user
usd
cutlery
wrench
Example: truck
element
boolean | null
Indicates if the Other Cost can be included in costs for Assets
Example: 1
cost_per_unit
number | null
Cost per unit of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
Example: 2.5
default_sell_price
number | null
Default sell price of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
Example: 4
default_sell_vat
number | null
Default sale VAT/IVA percentage of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
Example: 23
unit
string | null
Unit of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
relationships
object
The relationships of the Other Cost (Only present when expanded in the request)
customClientPrices
object
The Custom Client Prices associated with the Other Cost
entity
object
The Entity where the Other Cost belongs
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
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/other-costs' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-d '{
"name": "Contractual Labor",
"input_type": "currency",
"icon": "truck",
"failure": true,
"schedule_work": true,
"operator": true,
"element": true,
"cost_per_unit": 0,
"default_sell_price": 0,
"default_sell_vat": 0,
"unit": ""
}'
const response = await fetch('https://api.sandbox.infraspeak.com/v3/other-costs', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
"name": "Contractual Labor",
"input_type": "currency",
"icon": "truck",
"failure": true,
"schedule_work": true,
"operator": true,
"element": true,
"cost_per_unit": 0,
"default_sell_price": 0,
"default_sell_vat": 0,
"unit": ""
}),
});
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/other-costs',
array (
'name' => 'Contractual Labor',
'input_type' => 'currency',
'icon' => 'truck',
'failure' => true,
'schedule_work' => true,
'operator' => true,
'element' => true,
'cost_per_unit' => 0,
'default_sell_price' => 0,
'default_sell_vat' => 0,
'unit' => '',
)
);
import requests
response = requests.post(
'https://api.sandbox.infraspeak.com/v3/other-costs',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
json={
{
"name": "Contractual Labor",
"input_type": "currency",
"icon": "truck",
"failure": true,
"schedule_work": true,
"operator": true,
"element": true,
"cost_per_unit": 0,
"default_sell_price": 0,
"default_sell_vat": 0,
"unit": ""
}
},
)
data = response.json()