> For the complete documentation index, see [llms.txt](https://docs.api.persat.com.ar/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.persat.com.ar/modulos/gestion-de-entregas/obtener-estructura-esquema-de-un-tipo-de-entrega.md).

# Obtener estructura/esquema de un Tipo de Entrega

Para obtener la estructura/esquema de un tipo de Entrega, 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/deliveries-schemas/schema_id`

#### Path Parameters

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

#### 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": {
        "schema_group": 787,
        "schema_id": 398,
        "production": true,
        "version": 4,
        "draft": false,
        "name": "Entrega de Tienda Nube",
        "default_service_time": 10,
        "default_due_days": 2,
        "labels_ids": [
            3,
            8
        ],
        "instructions_description": {
            "widgets": [
                {
                    "id": "FWtQn2m9v",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWYBl1VyA",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FWiOVySSg",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FW8dvI3gO",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWJt5MLSn",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWykMSmmd",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWO63AbLU",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWBsxBUIQ",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWkLpYAEU",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FW6NzFzNu",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FW7kFoJTv",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWFkws90Z",
                    "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"
                            }
                        ]
                    }
                }
            ]
        },
        "results_description": {
            "widgets": [
                {
                    "id": "FW40IlFW1",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWy1RBJ2j",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FW29cS1UT",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWr752ZuM",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWGa6f4zq",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWkMi5Tos",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWrvecAy0",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWKFvJY55",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWYEmJTly",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWPvZlPgg",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWiCpxJy4",
                    "title": "Campo Foto",
                    "subtitle": "Imagen",
                    "widget_type": "IMAGE_FIELD"
                },
                {
                    "id": "FWTcXUki9",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWdWBC1FT",
                    "title": "Firma",
                    "subtitle": "firma digital",
                    "widget_type": "SIGNATURE_FIELD"
                },
                {
                    "id": "FWOIrekYj",
                    "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": "FWAHpt7u9",
                    "title": "Tabla Master Db",
                    "subtitle": "Complete los datos solicitados",
                    "widget_type": "MASTER_DB_TABLE",
                    "description": {
                        "mdb_id": 133,
                        "main_field": 1,
                        "show_fields": [],
                        "cols": [
                            {
                                "col_id": "USER_COL_zyNB1626881341371",
                                "name": "Cantidad",
                                "type": "NUMBER"
                            },
                            {
                                "col_id": "USER_COL_ZuDt1626881351792",
                                "name": "Descuento",
                                "type": "DROPDOWN"
                            },
                            {
                                "col_id": "USER_COL_ObtI1626881369567",
                                "name": "Observaciones",
                                "type": "TEXT"
                            },
                            {
                                "col_id": "USER_COL_tvse1626881378692",
                                "name": "sub Total",
                                "type": "CALCULATED"
                            }
                        ],
                        "total_fields": [
                            {
                                "total_field_id": "USER_TOTAL_YNLS1626881473036",
                                "name": "Descuento magico",
                                "type": "DROPDOWN"
                            },
                            {
                                "total_field_id": "USER_TOTAL_jltS1626881482952",
                                "name": "Total",
                                "type": "NUMBER"
                            }
                        ]
                    }
                },
                {
                    "id": "FW_FINAL_STATE",
                    "title": "Estado final de la entrega",
                    "subtitle": "Seleccione una de las opciones disponibles",
                    "widget_type": "DELIVERY_FINAL_STATE_WIDGET"
                }
            ]
        }
    }
}
```

{% 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": "'schema_id' debe ser un number (entero) obligatorio"
    }
}
```

{% endtab %}
{% endtabs %}

### Analizando la Respuesta

En caso que no haya ningun error, obtenemos

{% 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": {
        "schema_group": 787,
        "schema_id": 398,
        "production": true,
        "version": 4,
        "draft": false,
        "name": "Entrega de Tienda Nube",
        "default_service_time": 10,
        "default_due_days": 2,
        "labels_ids": [
            3,
            8
        ],
        "instructions_description": {
            "widgets": [
                {
                    "id": "FWtQn2m9v",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWYBl1VyA",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FWiOVySSg",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FW8dvI3gO",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWJt5MLSn",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWykMSmmd",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWO63AbLU",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWBsxBUIQ",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWkLpYAEU",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FW6NzFzNu",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWFkws90Z",
                    "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"
                            }
                        ]
                    }
                }
            ]
        },
        "results_description": {
            "widgets": [
                {
                    "id": "FW40IlFW1",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWy1RBJ2j",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FW29cS1UT",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWr752ZuM",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWGa6f4zq",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWkMi5Tos",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWrvecAy0",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWKFvJY55",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [ 
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWYEmJTly",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [ 
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWPvZlPgg",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [ 
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWiCpxJy4",
                    "title": "Campo Foto",
                    "subtitle": "Imagen",
                    "widget_type": "IMAGE_FIELD"    // deprecado
                },
                {
                    "id": "FWxblfGvY",
                    "title": "Campo Fotos",
                    "subtitle": "Subtitulo",
                    "widget_type": "MULTIPLE_IMAGES_FIELD"
                },                
                {
                    "id": "FWTcXUki9",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWdWBC1FT",
                    "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"
                },                
                {
                    "id": "FWOIrekYj",
                    "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": "FWAHpt7u9",
                    "title": "Tabla Master Db",
                    "subtitle": "Complete los datos solicitados",
                    "widget_type": "MASTER_DB_TABLE",
                    "description": {
                        "mdb_id": 133,
                        "main_field": 1,
                        "show_fields": [],
                        "cols": [
                            {
                                "col_id": "USER_COL_zyNB1626881341371",
                                "name": "Cantidad",
                                "type": "NUMBER"
                            },
                            {
                                "col_id": "USER_COL_ZuDt1626881351792",
                                "name": "Descuento",
                                "type": "DROPDOWN"
                            },
                            {
                                "col_id": "USER_COL_ObtI1626881369567",
                                "name": "Observaciones",
                                "type": "TEXT"
                            },
                            {
                                "col_id": "USER_COL_tvse1626881378692",
                                "name": "sub Total",
                                "type": "CALCULATED"
                            }
                        ],
                        "total_fields": [
                            {
                                "total_field_id": "USER_TOTAL_YNLS1626881473036",
                                "name": "Descuento magico",
                                "type": "DROPDOWN"
                            },
                            {
                                "total_field_id": "USER_TOTAL_jltS1626881482952",
                                "name": "Total",
                                "type": "NUMBER"
                            }
                        ]
                    }
                },
                {
                    "id": "FW_FINAL_STATE",
                    "title": "Estado final de la entrega",
                    "subtitle": "Seleccione una de las opciones disponibles",
                    "widget_type": "DELIVERY_FINAL_STATE_WIDGET"
                }
            ]
        }
    }
}
```

**schema\_group:** identificador del grupo al que pertenece el Tipo de Entrega. Cada vez que se crea una nueva versión, el shema\_id del tipo de entrega cambia, pero el schema\_group es el mismo.&#x20;

Entonces la Entrega de tipo "Entrega de Tienda Nube" tiene un schema\_group único, pero cada una de sus versiones tiene un schema\_id diferente.

**schema\_id:** Identificador unico del tipo de Entrega. Es único por versión.

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

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

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

**name:** Nombre del tipo de Entrega

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

**default\_due\_days:** Number. Días de vencimiento por default. Luego de "default\_due\_days" la entrega estará vencida.&#x20;

**labels\_ids:** Array de numbers, identificando etiquetas previamente creadas en Persat. Las nuevas entregas tendrán estas etiquetas por defecto apenas son creadas.

{% hint style="info" %}
Es una "referencia débil", 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 la entrega. Para ver los widgets disponibles puede acceder aqui [Tipos de Widgets](/modulos/formularios-digitales/tipos-de-widgets.md)

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](/modulos/formularios-digitales/tipos-de-widgets.md)
* 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 completó el chofer indicando que pasó con la entrega.

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