# Obtener estructura/esquema de un Tipo de OT

Para obtener la estructura/esquema de un tipo de Órden de Trabajo, se debe enviar un GET como el que se especifica a continuación.

<mark style="color:blue;">`GET`</mark> `https://api.persat.com.ar/v1/work-orders-schemas/wo_schema_id`

#### Path Parameters

| Name                                             | Type   | Description                                          |
| ------------------------------------------------ | ------ | ---------------------------------------------------- |
| wo\_schema\_id<mark style="color:red;">\*</mark> | Number | Identificador del tipo (esquema) de orden de trabajo |

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer API\_KEY |

{% tabs %}
{% tab title="200: OK La consulta se ejecutó con éxito" %}

```json
{
    "success": true,
    "data": {
        "wo_group": 120,
        "wo_shema_id": 452,
        "production": true,
        "version": 1,
        "draft": false,
        "name": "Orden de Trabajo Por API",
        "default_service_time": 45,
        "labels_ids": [
            1,
            2
        ],
        "instructions_description": {
            "widgets": [
                {
                    "id": "FWMg5UsWo",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWcimEHVv",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FWEMaj069",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWXyxyhlj",
                    "title": "Campo Link",
                    "subtitle": "Acceda a la información haciendo click",
                    "widget_type": "LINK_FIELD"
                },
                {
                    "id": "FW0Du7XbX",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWUPi54GM",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWqX5GCI0",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWfCFqRX2",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWwqEXxzV",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWxenlAxd",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWurAYM0k",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FW1XApyQH",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWSh8stXd",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FW91gUXpk",
                    "title": "Etiqueta",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "LABEL_FIELD",
                    "description": {
                        "options": [
                            {
                                "color": "RED",
                                "option_name": "Etiqueta 1"
                            },
                            {
                                "color": "ORANGE",
                                "option_name": "Etiqueta 2"
                            },
                            {
                                "color": "YELLOW",
                                "option_name": "Etiqueta 3"
                            }
                        ]
                    }                    
                },
                {
                    "id": "FWgBd9ZYe",
                    "title": "Tabla Smart",
                    "subtitle": "Ingrese los datos correspondientes",
                    "widget_type": "POWER_TABLE_FIELD",
                    "description": {
                        "static_rows": [
                            [
                                "Texto",
                                "0",
                                "0"
                            ]
                        ],
                        "cols": [
                            {
                                "name": "Columna 1",
                                "type": "TEXT"
                            },
                            {
                                "name": "Columna 2",
                                "type": "NUMBER"
                            },
                            {
                                "name": "Columna 3",
                                "type": "DROPDOWN"
                            }
                        ]
                    }
                },
                {
                    "id": "FWrwIRwOc",
                    "title": "Lista de Elementos",
                    "subtitle": "Seleccione una opción de la lista",
                    "widget_type": "CLIENT_OBJECT_DROPDOWN",
                    "description": {
                        "obj_id": 111,
                        "show_fields": [
                            1,
                            2,
                            3
                        ]
                    }
                }
            ]
        },
        "results_description": {
            "widgets": [
                {
                    "id": "FWXtmj1HI",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWBJHErUL",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FWVRm2Drt",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWv1OQzLF",
                    "title": "Campo Foto",
                    "subtitle": "Imagen",
                    "widget_type": "IMAGE_FIELD"
                },
                {
                    "id": "FW7Bxpy64",
                    "title": "Firma",
                    "subtitle": "firma digital",
                    "widget_type": "SIGNATURE_FIELD"
                }
            ]
        }
    }
}
```

{% endtab %}

{% tab title="404: Not Found No existe este tipo de OT" %}

```json
{
    "success": false,
    "error": {
        "status": 404,
        "type": "NOT_FOUND",
        "userMessage": "No hay un schema con id: 456464646546"
    }
}
```

{% endtab %}

{% tab title="400: Bad Request wo\_schema\_id no es un número" %}

```javascript
{
    "success": false,
    "error": {
        "status": 400,
        "type": "BAD_REQUEST",
        "userMessage": "'wo_schema_id' debe ser un number (entero) obligatorio"
    }
}
```

{% endtab %}
{% endtabs %}

### Analizando la Respuesta

En este ejemplo se muestra una órden de trabajo que utiliza todos los widgets disponibles en Persat.&#x20;

{% hint style="info" %}
Algunos widgets solo están disponibles en el formulario de devolución **results\_description**, y no asi en el formulario de indicaciones **instructions\_description**
{% endhint %}

```json
{
    "success": true,
    "data": {
        "wo_group": 120,
        "wo_shema_id": 452,
        "production": true,
        "version": 1,
        "draft": false,
        "name": "Orden de Trabajo Por API",
        "default_service_time": 45,
        "labels_ids": [
            1,
            2
        ],
        "instructions_description": {
            "widgets": [
                {
                    "id": "FWMg5UsWo",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWcimEHVv",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FWEMaj069",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWXyxyhlj",
                    "title": "Campo Link",
                    "subtitle": "Acceda a la información haciendo click",
                    "widget_type": "LINK_FIELD"
                },
                {
                    "id": "FW0Du7XbX",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWqX5GCI0",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWfCFqRX2",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWwqEXxzV",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWxenlAxd",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWurAYM0k",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FW1XApyQH",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FW91gUXpk",
                    "title": "Etiqueta",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "LABEL_FIELD",
                    "description": {
                        "options": [
                            {
                                "color": "RED",
                                "option_name": "Etiqueta 1"
                            },
                            {
                                "color": "ORANGE",
                                "option_name": "Etiqueta 2"
                            },
                            {
                                "color": "YELLOW",
                                "option_name": "Etiqueta 3"
                            }
                        ]
                    }                    
                },
                {
                    "id": "FWgBd9ZYe",
                    "title": "Tabla Smart",
                    "subtitle": "Ingrese los datos correspondientes",
                    "widget_type": "POWER_TABLE_FIELD",
                    "description": {
                        "static_rows": [
                            [
                                "Texto",
                                "0",
                                "0"
                            ]
                        ],
                        "cols": [
                            {
                                "name": "Columna 1",
                                "type": "TEXT"
                            },
                            {
                                "name": "Columna 2",
                                "type": "NUMBER"
                            },
                            {
                                "name": "Columna 3",
                                "type": "DROPDOWN"
                            }
                        ]
                    }
                },
                {
                    "id": "FWrwIRwOc",
                    "title": "Lista de Elementos",
                    "subtitle": "Seleccione una opción de la lista",
                    "widget_type": "CLIENT_OBJECT_DROPDOWN",
                    "description": {
                        "obj_id": 111,
                        "show_fields": [
                            1,
                            2,
                            3
                        ]
                    }
                }
            ]
        },
        "results_description": {
            "widgets": [
                {
                    "id": "FWXtmj1HI",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWBJHErUL",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FWVRm2Drt",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWv1OQzLF",
                    "title": "Campo Foto",
                    "subtitle": "Imagen",
                    "widget_type": "IMAGE_FIELD"    // deprecado
                },                
                {
                    "id": "FWxblfGvY",
                    "title": "Campo Fotos",
                    "subtitle": "Subtitulo",
                    "widget_type": "MULTIPLE_IMAGES_FIELD"
                },
                {
                    "id": "FW7Bxpy64",
                    "title": "Firma",
                    "subtitle": "firma digital",
                    "widget_type": "SIGNATURE_FIELD"  // deprecado
                },
                {
                    "id": "FWGez6FvL",
                    "title": "Firmas Digitales",
                    "subtitle": "Firma y aclaración",
                    "widget_type": "SIGNATURES_FIELD_V2"
                }                            
            ]
        }
    }
}
```

**wo\_group:** identificador del grupo al que pertenece el Tipo de Orden de Trabajo. Cada vez que se crea una nueva versión, el wo\_shema\_id de la misma cambia, pero el wo\_group es el mismo.&#x20;

Entonces la Orden de Trabajo "Control de Roedores" tiene un wo\_group único, pero cada una de sus versiones tiene un wo\_schema\_id diferente.

**wo\_schema\_id:** Identificador unico del tipo de Orden de Trabajo. Es único por versión.

**production:** Boolean indicando si este tipo de OT está en producción (publicada)

**version:** Número indicando la versión del Tipo de OT

**draft:** Boolean indicando si es un tipo de OT que está en borrador y todavia no fue publicada.

**name:** Nombre del tipo de OT

**default\_service\_time:** Number. Tiempo de servicio por default

**labels\_ids:** Array de numbers, identificando etiquetas previamente creadas en Persat.

{% hint style="info" %}
Es una "referencia débil" a las etiquetas, es decir que puede que no existan a la hora de hacer la consulta, debido a que el usuario administrador de Persat las sacó del sistema, o las modificó por otras.
{% endhint %}

**instructions\_description:** Objeto JSON que describe el formulario de indicaciones para el trabajo

**instructions\_description.widgets:** Array de objetos JSON, en donde cada item es un widget del formulario de indicacones para el trabajo. Para ver los widgets disponibles puede acceder aqui [Tipos de Widgets](https://docs.api.persat.com.ar/modulos/formularios-digitales/tipos-de-widgets)

Todos los widgets tienen la siguiente estructura

* id: **Obligatorio.** Identificador del widget
* title: **Obligatorio.** Titulo del widget
* subtitle: **Obligatorio.** Subtitulo del widget. Puede contener texto vacio ""
* widget\_type: **Obligatorio.** String identificando el tipo de widget. Ver [Tipos de Widgets](https://docs.api.persat.com.ar/modulos/formularios-digitales/tipos-de-widgets)
* description: <mark style="color:green;">**Opcional.**</mark> Solo se utiliza para los widgets mas complejos: SIMPLE\_SELECTION, DROPDOWN\_SELECTION, MULTIPLE\_SELECTION, LABEL\_FIELD, POWER\_TABLE\_FIELD, CLIENT\_OBJECT\_DROPDOWN, CLIENT\_OBJ\_TABLE y MASTER\_DB\_TABLE.&#x20;

**results\_description:** Objeto JSON que describe el formulario que es completado por eltécnico desde su teléfono móvil.

**results\_description.widgets:** Array de objetos JSON al igual que "instructions\_description.widgets"
