# Obtener estructura/esquema de un Formulario

Para obtener la estructura/esquema de un formulario, 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/digital-forms-schemas/schema_id`

#### Path Parameters

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

#### 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": {
        "form_group": 60,
        "schema_id": 170,
        "production": true,
        "version": 1,
        "draft": false,
        "description": {
            "title": "Crear Desde API",
            "color": "RED",
            "widgets": [
                {
                    "id": "FWA3VCpeS",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWMS4k794",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWNDBKSIr",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FWWbOUn2z",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FW27yy7bk",
                    "title": "Campo Link",
                    "subtitle": "Acceda a la información haciendo click",
                    "widget_type": "LINK_FIELD"
                },
                {
                    "id": "FWQXPDjee",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWWucoyGH",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWFFs0qST",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWT1C5xHM",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWVHsjhGQ",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWgGz4CLd",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWo7BxOeJ",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }                    
                },
                {
                    "id": "FWTyR07C8",
                    "title": "Campo Foto",
                    "subtitle": "Imagen",
                    "widget_type": "IMAGE_FIELD"
                },
                {
                    "id": "FWazD9hmI",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWZMnUuKK",
                    "title": "Firma",
                    "subtitle": "firma digital",
                    "widget_type": "SIGNATURE_FIELD"
                },
                {
                    "id": "FWMgSjrHE",
                    "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": "FWhvk40T3",
                    "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": "DROPDOWN"
                            },
                            {
                                "name": "Columna 3",
                                "type": "NUMBER"
                            }
                        ]
                    }
                },
                {
                    "id": "FWId3Z25r",
                    "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,
                            5,
                            6,
                            7
                        ]
                    }
                },
                {
                    "id": "FWjOLRNVB",
                    "title": "Tabla de Objetos en cliente",
                    "subtitle": "Complete los datos solicitados",
                    "widget_type": "CLIENT_OBJ_TABLE",
                    "description": {
                        "obj_id": 111,
                        "main_field": 3,
                        "show_fields": [
                            1,
                            2,
                            5
                        ],
                        "cols": [
                            {
                                "col_id": "USER_COL_oJie1649685993531",
                                "name": "Col texto",
                                "type": "TEXT"
                            },
                            {
                                "col_id": "USER_COL_tVMf1649685997315",
                                "name": "Col numero",
                                "type": "NUMBER"
                            },
                            {
                                "col_id": "USER_COL_povU1649686005054",
                                "name": "Col Lista",
                                "type": "DROPDOWN"
                            }
                        ]
                    }
                },
                {
                    "id": "FWGU2Ftw4",
                    "title": "Tabla Master Db",
                    "subtitle": "Complete los datos solicitados",
                    "widget_type": "MASTER_DB_TABLE",
                    "description": {
                        "mdb_id": 133,
                        "main_field": 2,
                        "show_fields": [
                            1,
                            3
                        ],
                        "cols": [
                            {
                                "col_id": "USER_COL_VDJD1649708416806",
                                "name": "Col texto",
                                "type": "TEXT"
                            },
                            {
                                "col_id": "USER_COL_CxbS1649708422321",
                                "name": "Col numero",
                                "type": "NUMBER"
                            },
                            {
                                "col_id": "USER_COL_jBVx1649708426690",
                                "name": "Col lista",
                                "type": "DROPDOWN"
                            },
                            {
                                "col_id": "USER_COL_UwOt1649708431360",
                                "name": "Campo calculado",
                                "type": "CALCULATED"
                            }
                        ],
                        "total_fields": [
                            {
                                "total_field_id": "USER_TOTAL_zmqh1649708466648",
                                "name": "Total texto",
                                "type": "TEXT"
                            },
                            {
                                "total_field_id": "USER_TOTAL_OjNg1649708485631",
                                "name": "Total numero",
                                "type": "NUMBER"
                            },
                            {
                                "total_field_id": "USER_TOTAL_bCpo1649708492977",
                                "name": "Total lista",
                                "type": "DROPDOWN"
                            },
                            {
                                "total_field_id": "USER_TOTAL_DbOq1649708498075",
                                "name": "Total calculado",
                                "type": "CALCULATED"
                            }
                        ]
                    }
                }
            ]
        }
    }
}
```

{% endtab %}

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

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

{% endtab %}

{% tab title="400: Bad Request 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 este ejemplo se muestra un formulario que utiliza todos los widgets disponibles en Persat.

```json
{
    "success": true,
    "data": {
        "form_group": 60,
        "schema_id": 170,
        "production": true,
        "version": 1,
        "draft": false,
        "description": {
            "title": "Crear Desde API",
            "color": "RED",
            "widgets": [
                {
                    "id": "FWA3VCpeS",
                    "title": "Campo Texto",
                    "subtitle": "Complete con los datos correspondientes",
                    "widget_type": "TEXT_FIELD"
                },
                {
                    "id": "FWMS4k794",
                    "title": "Seccion Nueva",
                    "subtitle": "Subtitulo",
                    "widget_type": "NEW_SECTION"
                },
                {
                    "id": "FWNDBKSIr",
                    "title": "Campo Parrafo",
                    "subtitle": "Complete las observaciones",
                    "widget_type": "TEXT_PARAGRAPH"
                },
                {
                    "id": "FW27yy7bk",
                    "title": "Campo Link",
                    "subtitle": "Acceda a la información haciendo click",
                    "widget_type": "LINK_FIELD"
                },
                {
                    "id": "FWQXPDjee",
                    "title": "Titulo",
                    "subtitle": "Subtitulo",
                    "widget_type": "STATIC_FIELD"
                },
                {
                    "id": "FWWucoyGH",
                    "title": "Campo Numero",
                    "subtitle": "Complete con el valor correspondiente",
                    "widget_type": "NUMBER_FIELD"
                },
                {
                    "id": "FWFFs0qST",
                    "title": "Campo Fecha",
                    "subtitle": "Seleccione la fecha",
                    "widget_type": "DATE_FIELD"
                },
                {
                    "id": "FWT1C5xHM",
                    "title": "Campo Hora",
                    "subtitle": "Seleccione el horario",
                    "widget_type": "TIME_FIELD"
                },
                {
                    "id": "FWVHsjhGQ",
                    "title": "Seleccion Simple",
                    "subtitle": "Seleccione alguna opción",
                    "widget_type": "SIMPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWgGz4CLd",
                    "title": "Seleccion Simple - Lista desplegable",
                    "subtitle": "Seleccione alguna opcion",
                    "widget_type": "DROPDOWN_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWo7BxOeJ",
                    "title": "Seleccion Multiple",
                    "subtitle": "Seleccione las opciones",
                    "widget_type": "MULTIPLE_SELECTION",
                    "description": {
                        "options": [
                            "Opcion 1",
                            "Opcion 2",
                            "Opcion 3"
                        ]
                    }
                },
                {
                    "id": "FWTyR07C8",
                    "title": "Campo Foto",
                    "subtitle": "Imagen",
                    "widget_type": "IMAGE_FIELD"    // deprecado
                },
                {
                    "id": "FWxblfGvY",
                    "title": "Campo Fotos",
                    "subtitle": "Subtitulo",
                    "widget_type": "MULTIPLE_IMAGES_FIELD"
                },
                {
                    "id": "FWZMnUuKK",
                    "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": "FWMgSjrHE",
                    "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": "FWhvk40T3",
                    "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": "DROPDOWN"
                            },
                            {
                                "name": "Columna 3",
                                "type": "NUMBER"
                            }
                        ]
                    }
                },
                {
                    "id": "FWId3Z25r",
                    "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,
                            5,
                            6,
                            7
                        ]
                    }
                },
                {
                    "id": "FWjOLRNVB",
                    "title": "Tabla de Objetos en cliente",
                    "subtitle": "Complete los datos solicitados",
                    "widget_type": "CLIENT_OBJ_TABLE",
                    "description": {
                        "obj_id": 111,
                        "main_field": 3,
                        "show_fields": [
                            1,
                            2,
                            5
                        ],
                        "cols": [
                            {
                                "col_id": "USER_COL_oJie1649685993531",
                                "name": "Col texto",
                                "type": "TEXT"
                            },
                            {
                                "col_id": "USER_COL_tVMf1649685997315",
                                "name": "Col numero",
                                "type": "NUMBER"
                            },
                            {
                                "col_id": "USER_COL_povU1649686005054",
                                "name": "Col Lista",
                                "type": "DROPDOWN"
                            }
                        ]
                    }
                },
                {
                    "id": "FWGU2Ftw4",
                    "title": "Tabla Master Db",
                    "subtitle": "Complete los datos solicitados",
                    "widget_type": "MASTER_DB_TABLE",
                    "description": {
                        "mdb_id": 133,
                        "main_field": 2,
                        "show_fields": [
                            1,
                            3
                        ],
                        "cols": [
                            {
                                "col_id": "USER_COL_VDJD1649708416806",
                                "name": "Col texto",
                                "type": "TEXT"
                            },
                            {
                                "col_id": "USER_COL_CxbS1649708422321",
                                "name": "Col numero",
                                "type": "NUMBER"
                            },
                            {
                                "col_id": "USER_COL_jBVx1649708426690",
                                "name": "Col lista",
                                "type": "DROPDOWN"
                            },
                            {
                                "col_id": "USER_COL_UwOt1649708431360",
                                "name": "Campo calculado",
                                "type": "CALCULATED"
                            }
                        ],
                        "total_fields": [
                            {
                                "total_field_id": "USER_TOTAL_zmqh1649708466648",
                                "name": "Total texto",
                                "type": "TEXT"
                            },
                            {
                                "total_field_id": "USER_TOTAL_OjNg1649708485631",
                                "name": "Total numero",
                                "type": "NUMBER"
                            },
                            {
                                "total_field_id": "USER_TOTAL_bCpo1649708492977",
                                "name": "Total lista",
                                "type": "DROPDOWN"
                            },
                            {
                                "total_field_id": "USER_TOTAL_DbOq1649708498075",
                                "name": "Total calculado",
                                "type": "CALCULATED"
                            }
                        ]
                    }
                }
            ]
        }
    }
}
```

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

Entonces el formulario "Nota de Pedido" tiene un form\_group único, pero cada una de sus versiones tiene un schema\_id diferente.

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

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

**version:** Número indicando la versión

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

**description:** Objeto Json con los siguientes fields

**description.title:** Nombre del formulario

**description.color:** String indicando el color del formulario.

{% hint style="info" %}
Los colores disponibles son:

* RED
* ORANGE
* YELLOW
* GREEN
* BLUE
* VIOLET
  {% endhint %}

**description.widgets:** Array de objetos JSON, en donde cada item es un widget del formulario. 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;
