# Asignar horario semanal

Permite asignar el horario laboral de toda la semana, pisando el horario actual para un dispositivo particular

<mark style="color:green;">`POST`</mark> `https://api.persat.com.ar/v1/devices/`<mark style="color:purple;">`:device_id`</mark>`/working_hours`

#### Headers

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

#### Path params

| Name                                         | Type   | Description                   |
| -------------------------------------------- | ------ | ----------------------------- |
| device\_id<mark style="color:red;">\*</mark> | number | Identificador del dispositivo |

#### Request Body

<table><thead><tr><th width="254">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>working_hours<mark style="color:red;">*</mark></td><td>Object</td><td>Objeto Json con 7 campos. Cada uno indicando el horario laboral para cada día de la semana</td></tr><tr><td>working_hours.monday<mark style="color:red;">*</mark></td><td>array de Objetos JSON</td><td>Ver ejemplo de request más abajo</td></tr><tr><td>working_hours.tuesday<mark style="color:red;">*</mark></td><td>array de Objetos JSON</td><td>Ver ejemplo de request más abajo</td></tr><tr><td>working_hours.wednesday<mark style="color:red;">*</mark></td><td>array de Objetos JSON</td><td>Ver ejemplo de request más abajo</td></tr><tr><td>working_hours.thursday<mark style="color:red;">*</mark></td><td>array de Objetos JSON</td><td>Ver ejemplo de request más abajo</td></tr><tr><td>working_hours.friday<mark style="color:red;">*</mark></td><td>array de Objetos JSON</td><td>Ver ejemplo de request más abajo</td></tr><tr><td>working_hours.saturday<mark style="color:red;">*</mark></td><td>array de Objetos JSON</td><td>Ver ejemplo de request más abajo</td></tr><tr><td>working_hours.sunday<mark style="color:red;">*</mark></td><td>array de Objetos JSON</td><td>Ver ejemplo de request más abajo</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK" %}

```json
{
    "success": true,
    "data": {}
}
```

{% endtab %}

{% tab title="400 BAD REQUEST" %}

```json
{
    "success": false,
    "error": {
        "status": 400,
        "type": "BAD_REQUEST",
        "userMessage": "\"monday\" is required"
    }
}
```

{% endtab %}

{% tab title="404 device NOT FOUND" %}

```json
{
    "success": false,
    "error": {
        "status": 404,
        "type": "NOT_FOUND",
        "userMessage": "No existe un device con este id: 144545"
    }
}
```

{% endtab %}
{% endtabs %}

### Ejemplo de Request

Ejemplo de body, en donde indicamos que los dos únicos días laborales son el lunes y el martes.

```json
{
    "working_hours": {
        "monday": [
            {
                "start": "09:30",
                "end": "17:00"
            }
        ],
        "tuesday": [
            {
                "start": "12:30",
                "end": "18:00"
            }
        ],
        "wednesday": [],
        "thursday": [],
        "friday": [],
        "saturday": [],
        "sunday": []
    }
}
```

{% hint style="warning" %}
Cada uno de los días de la semana es un array de objetos {start, end}. En la actualidad debe contener un único elemento.&#x20;

Se contempla de esta forma la posibilidad a futuro de que haya horarios de descanso intermedio
{% endhint %}


---

# 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/entidades-basicas/dispositivos/asignar-horario-laboral/asignar-horario-semanal.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.
