Create a work order

Learn how to create work orders through the API using different methods including from pending tasks, unscheduled tasks, work requests, and event-triggered tasks.

With 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:

  1. 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

  2. For creating WOs by creating from an unscheduled task, here are the following options:

    1. Unscheduled WO, through this option all task information must be sent to the endpoint.
    2. 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
  3. 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

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.

ParameterTypeRequiredDescription
typeIntegerYesWO creation type, for this case it is 2
item_codeTextYesCode of the asset associated with the WO. Can be consulted here. (field code)
responsible_codeTextYesCode of the human resource or third party associated with the WO
account_codeTextYesCode of the account that creates the WO
requested_byTextYesRequested by
task_descripcionTextYesTask description, which must not exceed 200 characters
task_type_mainTextYesTask type
task_type_description TextOptionalTask classification 1
task_type_2_description TextOptionalTask classification 2

Input parameters for creating a WO from an unscheduled task with event information

The following information must be sent in the request body.

ParameterTypeRequiredDescription
type IntegerYesWO creation type, for this case it is 3
item_code TextYesCode of the asset to which the WO will be performed
responsible_code TextOptional if third party information is sentCode of the human resource who will be responsible for the WO
third_party_code TextOptional if human resource information is sentCode of the third party where the contact who will be responsible for the WO is located
third_party_contact TextOptional if human resource information is sentName of the contact who will be responsible for the WO
account_code TextYesCode of the user account that will be registered as the creator of the WO
requested_by TextYesRequested by
id_task IntegerYesID of the task from which information will be obtained to create the WO
tasks_triggers_id IntegerYesEvent ID
id_group_task IntegerYesID of the task plan where the task from which information will be obtained is located
task_descripcion TextOptionalTask description (Default is the task name from id_task), which must not exceed 200 characters
task_type_main TextOptionalTask type (Default is from the task of id_task)
task_type_description TextOptionalTask classification 1 (Default is from the task of id_task)
task_type_2_description TextOptionalTask classification 2 (Default is from the task of id_task)
noteTextOptionalNote 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.

ParameterTypeRequiredDescription
typeIntegerYesWO creation type, for this case it is 2
item_codeTextYesCode of the asset associated with the WO. Can be consulted here. (field code)
responsible_codeTextYesCode of the human resource or third party associated with the WO
account_codeTextYesCode of the account that creates the WO
requested_byTextYesRequested by
task_descripcionTextYesTask description, which must not exceed 200 characters
task_type_mainTextYesTask type
id_requestIntegerYesWork 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.

ParameterTypeRequiredDescription
typeIntegerYesWO creation type, for this case it is 4
item_codeTextYesCode of the asset to which the WO will be performed
responsible_codeTextOptionalCode of the human resource who will be responsible for the WO
third_party_codeTextOptionalCode of the third party where the contact who will be responsible for the WO is located
third_party_contactTextOptionalName of the contact who will be responsible for the WO
account_codeTextYesCode of the user account that will be registered as the creator of the WO
requested_byTextYesRequested by
id_taskIntegerYesID of the task from which information will be obtained to create the WO
tasks_triggers_idIntegerYesEvent ID
id_group_taskIntegerYesID of the task plan where the task from which information will be obtained is located
date_maintenanceTextOptionalWO scheduling date. Format: 'YYYY-MM-DDTHH:MM:SS-UTC'
noteTextOptionalNote 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"

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"
}
{
    "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 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
}
Language