/works
Planned Jobs are refered in Infraspeak's API as Works.
This endpoint allows you to create a new Work (Planned Job).
createWork
Content-Type: application/json
· Required fields: _type, type, name, work_type_id, local_id, client_id
description
string | null
Description of the planned job
type
string
required
Type of the Planned Job
CYCLIC
PLAN
SPECIAL
_type
string
required
works
any_responsible
boolean
If true anyone can start the planned job, if false `operator_id` or `technical_skill_id` must be filled
auto_close
boolean
Indication if the planned job order can be automatically closed, when all tasks are completed. Used only when `type` is "CYCLIC" or "PLAN".
auto_pilot
boolean
Indication if any user can start this planned job. Used only when `type` is "CYCLIC" or "PLAN".
auto_schedule
array<object>
Information for automatically scheduling events for the Planned Job
is_enabled
boolean
Enables auto schedule
start_time
string
required
The start time for scheduling Events in 24-hour format (HH:mm)
Example: 10:00
end_time
string
required
The end time for scheduling Events in 24-hour format (HH:mm)
Example: 11:00
operators
array<integer>
required
IDs of the operators assigned to the events
calendar_id
integer
ID of the Calendar. Required when `type` is "CYCLIC" and `recurrence.FREQ` is "HOURLY".
client_id
integer
required
ID of the Client
cost_center_id
integer | null
ID of the Cost Center
failure_id
integer | null
ID of the Failure
gatekeeper_id
integer
ID of the Gatekeeper
gatekeeper_notification
array<integer>
ID of operators to receive the Gatekeeper Notification
interventions
array<object>
List of interventions to be performed. Required when `type` is "CYCLIC" or "PLAN".
id
integer
elements
array<object>
id
string
is_protected
boolean
Protect Planned Job from Manager edition / deletion
local_id
array<integer>
required
ID's of the locations associated to the planned job
name
string
required
Brief description of the planned job
operator_id
array<integer>
ID's of Operators associated to the planned job
procedures
array<object>
List with Procedure objects. Only used when `type` is "SPECIAL".
task
string
Name of the task to be performed
quantity
number
unit
string
The measure unit of the `quantity`
recurrence
object
Information about the recurrence
DTSTART
string (date-time)
Start date and time for the Planned Job
Example: 2022-05-29T17:32:28
UNTIL
string (date-time)
End date and time for the Planned Job
Example: 2022-05-30T17:32:28
FREQ
string
Type of frequency of the recurrence.
HOURLY
DAILY
WEEKLY
MONTHLY
YEARLY
UBM
INTERVAL
number
Interval unit of the recurrence, greater or equal than 0. Required if type is "CYCLIC" and FREQ is HOURLY.
reminder_rules
array<object>
List with reminder rules objects
calendar_id
integer
notes
string
notify_hours
integer
notify_client_contacts
boolean
notify_building_contacts
boolean
notify_contacts
array<integer>
sla_rules
array<object>
List of SLA rules associated to the planned job
calendar_id
string
notify_hours
integer | null
pausable
boolean
start_status
string
Example: SCHEDULED
target_hours
integer
target_status
string
Example: COMPLETED
specify_pause_reason
boolean
Whether pause reasons must be specified for this SLA rule
pause_reasons
array<string>
List of pause reasons for this SLA rule. There should be at least one pause reason selected if specify_pause_reason is true.
sla_rules_receivers
array<object>
Who should receive notifications for SLA rules
notify_client_building_responsibles
boolean
notify_work_responsibles
boolean
operators
array<integer>
supplier_id
integer | null
ID of the Supplier
technical_skill_id
array<integer>
ID's of Technical Skills associated to the planned job
work_notifications
array<object>
List with Work Notifications
trigger
string
The condition when the notification should be sent
CLOSE
CONFIRM
client_contacts
boolean
Whether to notify client associated contacts
building_contacts
boolean
Whether to notify building associated contacts
specific_contacts
array<integer>
IDs of specific contacts to notify
client_operators
boolean
Whether to notify client associated operators
building_operators
boolean
Whether to notify building associated operators
technical_skill_operators
boolean
Whether to notify operators (technician) with the associated technical skill
specific_operators
array<integer>
IDs of specific operators to notify
work_type_id
integer
required
ID of the WorkType
data
array<object>
id
string
read-only
ID of the planned job
type
string
read-only
Model type
work
attributes
object
calendar_id
integer | null
ID for the Calendar
Example: 259
description
string | null
Description of the planned job
Example: PMP description
type
string | null
Type of the planned job. Null if the Planned Job is related to a Work Order (failure)
CYCLIC
PLAN
SPECIAL
any_responsible
boolean
auto_close
boolean
Indication if the planned job order can be automatically closed, when all tasks are completed
Example:
auto_pilot
boolean
Indication if any user can start this planned job
Example:
client_id
integer
ID of the Client
Example: 22349
cost_center_id
integer | null
ID of the Cost Center
Example: 17
entity_id
integer
ID of the Entity
Example: 12
failure_id
integer | null
ID of the Work Order
Example: 1448321
gatekeeper_id
integer | null
ID for the Gatekeeper
Example: 159
is_protected
boolean | null
Protect Planned Job from Manager edition / deletion
Example: 1
name
string
Description of the planned job
Example: PMP HVAC
network_work_id
integer
ID used to reference a shared Planned Job
Example: 123
periodicity
string | null
Description of the Planned Job periodicity. Null if the Planned Job is related to a Work Order (failure)
Example: Plano de 1 ano, com visita em Setembro
recurrence
object | null
Information about the Planned Job recurrence. Null if the Planned Job is related to a Work Order (failure)
DTSTART
string (date-time)
Example: 2022-04-01 09:00:00
supplier_id
integer | null
ID of the Supplier
Example: 54
work_id
integer
ID of the planned job
work_type_id
integer
ID of the Planned Job Type
Example: 448
relationships
object
The relationships of the Work (Only present when expanded in the request)
networkStatus
object
data
array<object>
type
string
read-only
If RECEIVER the Work was received on Network, if SENDER the Work was sent to the Network.
SENDER
RECEIVER
id
string
read-only
shared
boolean
read-only
If the Work is actively shared on Network.
in_sync
boolean
read-only
If the Work is in sync of execution with the Network.
action
string
read-only
If UNSHARED, the Work was unshared from Network, if null, no action was taken.
network_entity_uuid
string
read-only
The UUID of the Network Entity related to the Work network status.
network_relation_id
integer
read-only
The ID of the Network Relation related to the Work network status. It can be from a Client or a Supplier.
network_relation_type
string
read-only
The type of Network Relation related to the Work network status. It can be from a Client or a Supplier, used to identify the relation ID and the relation the Network Entity has to the Work.
CLIENT
SUPPLIER
meta
object
Meta model structure details
pagination
object
total
integer
required
Total items.
Example: 1
count
integer
required
Total items returned for the current page.
Example: 1
per_page
integer
required
Maximum number of records per page.
Example: 1
current_page
integer
required
Number of the current page.
total_pages
integer
required
Number of the total pages.
links
object
Requests that return multiple items include a `links` attribute, with links related to request's context.
self
string
required
read-only
Current response link.
Example: /path?page=1
first
string
required
read-only
Link to the first page result.
Example: /path?page=1
last
string
required
read-only
Link to the previous page result.
Example: /path?page=1
next
string
read-only
Link to the next page result.
Example: /path?page=1
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 POST \
'https://api.sandbox.infraspeak.com/v3/works' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-d '{
"description": "",
"type": "",
"_type": "",
"any_responsible": false,
"auto_close": false,
"auto_pilot": false,
"auto_schedule": [],
"calendar_id": 0,
"client_id": 0,
"cost_center_id": 0,
"failure_id": 0,
"gatekeeper_id": 0,
"gatekeeper_notification": [],
"interventions": [],
"is_protected": false,
"local_id": [],
"name": "",
"operator_id": [],
"procedures": [],
"recurrence": "",
"reminder_rules": [],
"sla_rules": [],
"sla_rules_receivers": [],
"supplier_id": 0,
"technical_skill_id": [],
"work_notifications": [],
"work_type_id": 0
}'
const response = await fetch('https://api.sandbox.infraspeak.com/v3/works', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
"description": "",
"type": "",
"_type": "",
"any_responsible": false,
"auto_close": false,
"auto_pilot": false,
"auto_schedule": [],
"calendar_id": 0,
"client_id": 0,
"cost_center_id": 0,
"failure_id": 0,
"gatekeeper_id": 0,
"gatekeeper_notification": [],
"interventions": [],
"is_protected": false,
"local_id": [],
"name": "",
"operator_id": [],
"procedures": [],
"recurrence": "",
"reminder_rules": [],
"sla_rules": [],
"sla_rules_receivers": [],
"supplier_id": 0,
"technical_skill_id": [],
"work_notifications": [],
"work_type_id": 0
}),
});
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/works',
array (
'description' => '',
'type' => '',
'_type' => '',
'any_responsible' => false,
'auto_close' => false,
'auto_pilot' => false,
'auto_schedule' =>
array (
),
'calendar_id' => 0,
'client_id' => 0,
'cost_center_id' => 0,
'failure_id' => 0,
'gatekeeper_id' => 0,
'gatekeeper_notification' =>
array (
),
'interventions' =>
array (
),
'is_protected' => false,
'local_id' =>
array (
),
'name' => '',
'operator_id' =>
array (
),
'procedures' =>
array (
),
'recurrence' => '',
'reminder_rules' =>
array (
),
'sla_rules' =>
array (
),
'sla_rules_receivers' =>
array (
),
'supplier_id' => 0,
'technical_skill_id' =>
array (
),
'work_notifications' =>
array (
),
'work_type_id' => 0,
)
);
import requests
response = requests.post(
'https://api.sandbox.infraspeak.com/v3/works',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
json={
{
"description": "",
"type": "",
"_type": "",
"any_responsible": false,
"auto_close": false,
"auto_pilot": false,
"auto_schedule": [],
"calendar_id": 0,
"client_id": 0,
"cost_center_id": 0,
"failure_id": 0,
"gatekeeper_id": 0,
"gatekeeper_notification": [],
"interventions": [],
"is_protected": false,
"local_id": [],
"name": "",
"operator_id": [],
"procedures": [],
"recurrence": "",
"reminder_rules": [],
"sla_rules": [],
"sla_rules_receivers": [],
"supplier_id": 0,
"technical_skill_id": [],
"work_notifications": [],
"work_type_id": 0
}
},
)
data = response.json()