# Modificar formulario

Para modificar un formulario en Persat, se debe enviar un PUT como el que se especifica a continuación.

<mark style="color:orange;">`PUT`</mark> `https://api.persat.com.ar/v1/digital-forms/form_id`

#### Path Parameters

| Name                                       | Type   | Description                  |
| ------------------------------------------ | ------ | ---------------------------- |
| form\_id<mark style="color:red;">\*</mark> | String | Identificador del formulario |

#### Headers

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

#### Request Body

| Name                                                  | Type   | Description                                              |
| ----------------------------------------------------- | ------ | -------------------------------------------------------- |
| df\_data.formvalues<mark style="color:red;">\*</mark> | Object | Cada uno de los valores para cada wiidget del formulario |

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

```json
{
    "success": true,
    "data": {
        "_id": "195",
        "created": "2022-05-18T16:00:50.000Z",
        "created_by_user_name": "Creado por Api",
        "created_by_user_id": -1,
        "client": {
            "id": 12796,
            "name": "Persat Veinte",
            "uid_client": "CL-Test_20"
        },
        "df_data": {
            "schema_id": 150,
            "results": {
                "last_updated": "2022-05-19T10:43:22.000Z",
                "formvalues": {
                    "FWA3VCpeS": "Texto modificado",
                    "FWWucoyGH": 321.1
                }
            }
        },
        "state": {
            "color": "BLUE",
            "deleted": false,
            "id": 26,
            "name": "Listo"
        },
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Error en alguno de los campos enviados. userMessage contiene informacipon adicional." %}

```json
{
    "success": false,
    "error": {
        "status": 400,
        "type": "BAD_REQUEST",
        "userMessage": "Error en el widget 'FWNDBKSIr'. Debe ser un numero"
    }
}
```

{% endtab %}

{% tab title="404: Not Found Formulario no existe" %}

```javascript
{
    "success": false,
    "error": {
        "status": 404,
        "type": "NOT_FOUND",
        "userMessage": "No hay un formulario con este numero"
    }
}
```

{% endtab %}
{% endtabs %}

### Ejemplo de request

En este ejemplo modificamos el formulario en uno de sus widgets, el FWA3VCpeS. Si quisiera modificar mas campos, solo es cuestion de colocar el widget id y su valor, de forma similar a como se hace en [Insertar Formulario](/modulos/formularios-digitales/insertar-formulario.md)

#### body

```json
{
    "df_data": {
        "formvalues": {
            "FWA3VCpeS": "Valor modificado"
        }
    }
}
```

### Analizando la Respuesta

En caso que no haya ningun error, obtenemos una respuesta de este estilo. La explicación de cada uno de los campos se puede ver en la sección [Obtener Formulario](/modulos/formularios-digitales/obtener-formulario.md)

```json
{
    "success": true,
    "data": {
        "_id": "195",
        "created": "2022-05-18T16:00:50.000Z",
        "created_by_user_name": "Creado por Api",
        "created_by_user_id": -1,
        "client": {
            "id": 12796,
            "name": "Persat Veinte",
            "uid_client": "CL-Test_20"
        },
        "df_data": {
            "schema_id": 150,
            "results": {
                "last_updated": "2022-05-19T10:43:22.000Z",
                "formvalues": {
                    "FWA3VCpeS": "Valor modificado",
                    "FWWucoyGH": 321.1
                }
            }
        },
        "state": {
            "color": "BLUE",
            "deleted": false,
            "id": 26,
            "name": "Listo"
        },
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.persat.com.ar/modulos/formularios-digitales/modificar-formulario.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
