Learn how to create work orders through the API using different methods including from pending tasks, unscheduled tasks, work requests, and event-triggered tasks.
GET https://app.fracttal.com/api/work_ordersWith this API, you can create a work order in the following ways:
- From pending tasks.
- From an unscheduled task.
- From an unscheduled task with information from an event.
- From an event-triggered task.
- From a work request.
This web service is part of the ADVANCED APIs add-on.
Notes:
-
For creating WOs with tasks found in pending tasks, take into account: To obtain the IDs of the pending tasks that you want to turn into a WO, you must consult the API Query pending tasks
-
For creating WOs by creating from an unscheduled task, here are the following options:
- Unscheduled WO, through this option all task information must be sent to the endpoint.
- Unscheduled WO triggered by event, through this option the task will take as a base all information contained in the event of the task plan. For this, take into account:
The event from which the data is taken cannot have associated resources.
To obtain information related to the trigger and the task, it is necessary to consult the web service Query detailed information from task plans
-
For creating WOs based on a work request, the work request must be active and cannot be associated with another WO. Work requests can be consulted here
Input parameters for creating a WO from a pending task
The following information must be sent in the request body.
| Parameters | Type | Required | Description |
|---|---|---|---|
type | Integer | Yes | WO creation type, for this case it is 1 |
responsible_code | Text | Optional if third party information is sent | Code of the human resource who will be responsible for the WO. Can be consulted here. (field code) |
third_party_code | Text | Optional if human resource information is sent | Code of the third party where the contact who will be responsible for the WO is located. Can be consulted here. (field code) |
third_party_contact | Text | Optional if human resource information is sent | Name of the contact who will be responsible for the WO |
account_code | Text | Yes | Code of the user account that will be registered as the creator of the WO. The user must be of the human resources type |
tasks_todo | JSON Array | Yes | Array with pending tasks information. Each json must contain the tasks_todo_id parameter that corresponds to the task id in pending tasks |
annotations | JSON | No | The annotations object must comply with the following validation rules: • Must contain at least one of the allowed fields: "id_wo_related" : "string", "code_wo_related" : "string", "wo_related_status" : "string" |
Input parameters for creating a WO from an unscheduled task
The following information must be sent in the request body.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | Integer | Yes | WO creation type, for this case it is 2 |
item_code | Text | Yes | Code of the asset associated with the WO. Can be consulted here. (field code) |
responsible_code | Text | Yes | Code of the human resource or third party associated with the WO |
account_code | Text | Yes | Code of the account that creates the WO. The user must be of the human resources type |
requested_by | Text | Yes | Requested by |
task_descripcion | Text | Yes | Task description, which must not exceed 200 characters |
task_type_main | Text | Yes | Task type |
task_type_description | Text | Optional | Task classification 1 |
task_type_2_description | Text | Optional | Task classification 2 |
note | Text | Optional | Note of the work order itself. Now persists correctly and is visible in the WO listing and detail (independent from the task note used when creating a WO from an unscheduled task with event information or from an event-triggered task, which is unchanged). |
label_descriptions | Array of text | Optional | Descriptions of labels that already exist in the catalog, to associate with the WO (does not accept numeric IDs). Each label must already exist and be enabled for the company; it is not auto-created. Only applies when type is 2. |
label_descriptions rules:
- Can only be sent when
typeis 2. If sent with a differenttype, the request is rejected. - Each element must be text (not numbers or objects) and must match the name of a label that already exists and is enabled for the company.
- If any given label does not exist or is disabled, neither the WO nor the label are created — the operation is all or nothing.
Input parameters for creating a WO from an unscheduled task with event information
The following information must be sent in the request body.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | Integer | Yes | WO creation type, for this case it is 3 |
item_code | Text | Yes | Code of the asset to which the WO will be performed |
responsible_code | Text | Optional if third party information is sent | Code of the human resource who will be responsible for the WO |
third_party_code | Text | Optional if human resource information is sent | Code of the third party where the contact who will be responsible for the WO is located |
third_party_contact | Text | Optional if human resource information is sent | Name of the contact who will be responsible for the WO |
account_code | Text | Yes | Code of the user account that will be registered as the creator of the WO. The user must be of the human resources type |
requested_by | Text | Yes | Requested by |
id_task | Integer | Yes | ID of the task from which information will be obtained to create the WO |
tasks_triggers_id | Integer | Yes | Event ID |
id_group_task | Integer | Yes | ID of the task plan where the task from which information will be obtained is located |
task_descripcion | Text | Optional | Task description (Default is the task name from id_task), which must not exceed 200 characters |
task_type_main | Text | Optional | Task type (Default is from the task of id_task) |
task_type_description | Text | Optional | Task classification 1 (Default is from the task of id_task) |
task_type_2_description | Text | Optional | Task classification 2 (Default is from the task of id_task) |
note | Text | Optional | Note of the task associated with the WO |
Input parameters for creating a WO from a work request
The following information must be sent in the request body.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | Integer | Yes | WO creation type, for this case it is 2 |
item_code | Text | Yes | Code of the asset associated with the WO. Can be consulted here. (field code) |
responsible_code | Text | Yes | Code of the human resource or third party associated with the WO |
account_code | Text | Yes | Code of the account that creates the WO. The user must be of the human resources type |
requested_by | Text | Yes | Requested by |
task_descripcion | Text | Yes | Task description, which must not exceed 200 characters |
task_type_main | Text | Yes | Task type |
id_request | Integer | Yes | Work request ID. Can be consulted here. (field id_code) |
Input parameters for creating a WO from an event-triggered task
The following information must be sent in the request body.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | Integer | Yes | WO creation type, for this case it is 4 |
item_code | Text | Yes | Code of the asset to which the WO will be performed |
responsible_code | Text | Optional | Code of the human resource who will be responsible for the WO |
third_party_code | Text | Optional | Code of the third party where the contact who will be responsible for the WO is located |
third_party_contact | Text | Optional | Name of the contact who will be responsible for the WO |
account_code | Text | Yes | Code of the user account that will be registered as the creator of the WO. The user must be of the human resources type |
requested_by | Text | Yes | Requested by |
id_task | Integer | Yes | ID of the task from which information will be obtained to create the WO |
tasks_triggers_id | Integer | Yes | Event ID |
id_group_task | Integer | Yes | ID of the task plan where the task from which information will be obtained is located |
date_maintenance | Text | Optional | WO scheduling date. Format: 'YYYY-MM-DDTHH:MM:SS-UTC' |
note | Text | Optional | Note of the task associated with the WO |
Output parameters
| Parameter | Type | Description |
|---|---|---|
wo_folio | Text | WO ID |
creation_date | Text | WO creation date |
duration | Integer | Work order duration |
id_works_ordes_task | Integer | Task ID |
id_status_work_order | Integer | 1: WO in Process 2: WO under Review 3: WO Completed 4: WO cancelled |
final_date | Text | Task final date |
completed_percentage | Text | Work order completion percentage |
created_by | Text | Work order generator name |
code | Text | Asset code |
items_log_description | Text | Asset description |
done | Text | True if task is already finished and False if task is not finished |
description | Text | Task description |
id_request | Text | Request ID, if task comes from a request |
stop_assets | Text | True if asset is stopped and False if asset is NOT stopped |
stop_assets_sec | Integer | Asset stop time (seconds) |
tasks_log_task_type_main | Text | Task type |
parent_description | Text | Asset location |
resources_hours | Text | Sum of hours of human resources used |
trigger_description | Text | Trigger type |
resources_inventory | Text | Inventory type resources in task |
resources_human_resources | Text | Human resources in task |
cal_date_maintenance | Text | Task calculated date |
real_duration | Integer | Task real duration |
date_maintenance | Text | Task scheduling date |
user_assigned | Text | Assigned user |
note | Text | Work order note |
details_signature | Text | Work order signature details |
first_date_task | Text | Start date of the next task to be performed |
costs_center_description | Text | Asset cost center |
tasks_duration | Text | Task estimated duration |
total_cost_task | Text | WO total cost |
requested_by | Text | Requester of an unscheduled task |
groups_description | Text | Asset 'Type' information |
groups_1_description | Text | Asset classification 1 |
groups_2_description | Text | Asset classification 2 |
has_children | Text | True if work order has child work orders |
real_stop_assets_sec | Text | Asset real stop time |
wo_final_date | Text | Work order final date |
tasks_log_types_description | Text | Task classification 1 |
tasks_log_types_2_description | Text | Task classification 2 |
rating | Text | WO rating |
code_responsible | Text | WO responsible code |
work_orders_status_custom_description | Text | Cancellation reason |
types_description | Text | Failure type |
causes_description | Text | Failure cause |
detection_method_description | Text | Failure detection method |
severiry_description | Text | Failure severity |
damages_types_description | Text | Type of damage caused |
caused_damage | Text | Cause of damage caused |
id_priorities | Text | Task priority ID |
priorities_description | Text | Task priority description |
annotations | JSON | Object containing additional information. "id_wo_related" : "string", "code_wo_related" : "string", "wo_related_status" : "string" |
Errors
Errors specific to label_descriptions (type = 2):
| Code | Cause |
|---|---|
| 400 | label_descriptions was sent with a type other than 2. |
| 400 | label_descriptions is not an array. |
| 400 | Some element of label_descriptions is not text. |
| 400 | Some description in label_descriptions does not exist or is disabled for the company. |
| 401 | Invalid, expired, or missing authentication token. |
| 403 | The account does not have permission to create Work Orders. |
Examples:
Tasks from pending tasks:
Request: (POST)https://app.fracttal.com/api/work_orders
{
"type":1,
"responsible_code": "7809097-2",
"account_code": "7845123",
"tasks_todo":[
{
"tasks_todo_id":1600093
},
{
"tasks_todo_id":1087
}
],
"annotations": {
"id_wo_related": "12345",
"code_wo_related": "WO-2025-001",
"wo_related_status": "OPEN"
}
}{
"success": true,
"message": "200",
"data": {
"id": 1130348,
"id_company": 69,
"id_status_work_order": 1,
"wo_folio": "OT-1731",
"creation_date": "2021-07-27T14:43:38.330737+00:00",
"duration": 1200,
"id_assigned_user": null,
"initial_date": null,
"final_date": null,
"completed_percentage": 0,
"id_created_by": 40,
"created_by": "Alejandra Arango",
"signature": null,
"note": null,
"details_signature": null,
"id_validated_by": null,
"first_date_task": null,
"id_personnel_log": 10073,
"id_contacts_log": null,
"id_parent": null,
"is_offline": null,
"id_account_offline": null,
"code_created_by": "7845123",
"rating": null,
"enable_budget": false,
"id_work_orders_status_custom": null,
"review_date": null,
"id_accounts_log_validated_by": null,
"id_public": null,
"statistics": null,
"type_user": "HUMAN_RESOURCES",
"id_responsible": 60,
"id_account_responsible": null,
"description": "OT-1731",
"annotations": {
"id_wo_related": "12345",
"code_wo_related": "WO-2025-001",
"wo_related_status": "OPEN"
}
}Creating WOs from an unscheduled task:
Request: (POST)https://app.fracttal.com/api/work_orders
{
"type": 2,
"item_code": "EQM032",
"responsible_code": "RH-002",
"account_code": "RH-002",
"requested_by": "Ruben Prieto",
"task_descripcion": "Test work order",
"task_type_main": "Corrective",
"note": "Review before Friday",
"label_descriptions": ["Urgent", "Warranty"]
}{
"success": true,
"message": "200",
"data": {
"id_work_order": 11934394,
"wo_folio": "OT-2420",
"id_work_order_task": 20338615,
"id_status_work_order": 1,
"user_type": "HUMAN_RESOURCES",
"responsible": "Pepito perez",
"responsible_code": "RH-002",
"date_created": "2023-11-10T20:44:59.479973+00:00",
"created_by": "Pepito perez"
},
"total": 1
}Response — non-existent or disabled label (400):
{
"success": false,
"message": "Some label descriptions do not exist or are disabled: NoExiste",
"total": 0,
"data": null
}Response — label_descriptions sent outside of type = 2 (400):
{
"success": false,
"message": "label_descriptions is only supported when type = 2 (Unplanned Task)",
"total": 0,
"data": null
}Creating WOs from an unscheduled task with event information:
Request: (POST)https://app.fracttal.com/api/work_orders
{
"type": 3,
"item_code": "118",
"responsible_code": "32322",
"account_code": "25198772-2",
"requested_by": "Fracttal SPA",
"id_task": 86,
"task_descripcion": "New task generated by API",
"tasks_triggers_id": 27,
"id_group_task": 1,
"task_type_main": "Corrective",
"task_type_description": "MECHANICAL",
"task_type_2_description": "REQUIRES HEIGHT PERMIT"
}{
"success": true,
"message": "200",
"data": {
"wo_folio": "OT-1694",
"id_status_work_order": 1,
"responsible": "FRACTTAL SPA",
"responsible_code": "32322",
"date_created": "2021-05-11T14:54:45.294203+00:00",
"created_by": "Laura Marcela Peña Jaramillo"
},
"total": 1
}Creating WOs from a work request:
Request: (POST)https://app.fracttal.com/api/work_orders
{
"type": 2,
"item_code": "EQM032",
"responsible_code": "RH-002",
"account_code": "RH-002",
"requested_by": "Ruben Prieto",
"task_descripcion": "Test work order",
"task_type_main": "Corrective",
"id_request": 1827
}{
"success": true,
"message": "200",
"data": {
"id_work_order": 11934394,
"wo_folio": "OT-2420",
"id_work_order_task": 20338615,
"id_status_work_order": 1,
"user_type": "HUMAN_RESOURCES",
"responsible": "Pepito perez",
"responsible_code": "RH-002",
"date_created": "2023-11-10T20:44:59.479973+00:00",
"created_by": "Pepito perez"
},
"total": 1
}Creating WOs from an event-triggered task:
Request: (POST)https://app.fracttal.com/api/work_orders
{
"type": 4,
"responsible_code": "SV-CODE",
"account_code": "SV-CODE",
"item_code": "F1_1190-ASST-CODE",
"id_group_task": 277312,
"id_task": 14011472,
"task_trigger_id": 14011472,
"date_maintenance": "2016-07-12T20:00:00-03", //Optional
"note": "TEST NOTE" //Optional
}{
"success": true,
"message": "200",
"data": {
"wo_folio": "OT-1694",
"id_status_work_order": 1,
"responsible": "FRACTTAL SPA",
"responsible_code": "32322",
"date_created": "2021-05-11T14:54:45.294203+00:00",
"created_by": "Laura Marcela Peña Jaramillo"
},
"total": 1
}