# Plataforma - OnReports



# Listar reportes - getReports

##### <span class="api-method" data-method="POST">POST</span> https://api.service24gps.com/api/v1/getReports

Obtiene el listado de reportes asignados al usuario.

<details class="mb-m" id="bkmrk-body-parametersparam"><summary class="text-muted">Ver parámetros de solicitud:</summary>

<div><table class="table" style="height: 139px;"><tbody><tr style="height: 41px;"><th style="width: 188px; height: 41px;">Parámetros</th><th style="width: 320px; height: 41px;">Descripción</th><th style="width: 301px; height: 41px;">Ejemplo</th></tr><tr style="height: 57px;"><td style="width: 188px; height: 57px;">apikey</td><td style="width: 320px; height: 57px;">Llave de autorización para uso de los Servicios Web.</td><td style="width: 301px; height: 57px;"><span role="presentation" style="padding-right: 0.1px; color: #3366ff;">25sdsd234234aa93sdsdsd37c70118e72</span></td></tr><tr style="height: 41px;"><td style="width: 188px; height: 41px;">token</td><td style="width: 320px; height: 41px;">Token devuelto por el método getToken.</td><td style="width: 301px; height: 41px;"><span style="color: #3366ff;">wfszR/oPIQKjt5HT5NgjDnZ2SAZQ==</span></td></tr></tbody></table>

</div></details>##### Solicitud de ejemplo:

```shell
curl --location --request POST 'https://api.service24gps.com/api/v1/getReports' \
--form 'apikey="25sdsd234234aa93sdsdsd37c70118e72"' \
--form 'token="wfszR/oPIQKjt5HT5NgjDnZ2SAZQ=="'
```

##### Respuesta de ejemplo:

```JSON
{
   "status": 200,
    "data": [
        {
            "id": "33",
            "nombre": "Distancia recorrida",
            "descripcion": "En este reporte podrá ver la distancia recorrida en kilometros que realizó el activo en diferentes días, horarios y rango de fechas (puede utilizar horario o jornada laboral)",
            "columnas": [
                "Activo",
                "Conductor",
                "Placa",
                "Fecha inicial",
                "Hora inicial",
                "Lugar inicio",
                "Fecha final",
                "Hora final",
                "Lugar final",
                "Tiempo de viaje",
                "Distancia recorrida"
            ],
            "filtros": {
                "sino_mostrar_detalle": {
                    "tipo": "boolean",
                    "titulo": "Detalle de la distancia recorrida",
                    "descripcion": "Muestra el total de km del periodo de tiempo que se haya elegido y no por dia."
                },
                "sino_calcular_paradas": {
                    "tipo": "boolean",
                    "titulo": "Calcular paradas",
                    "descripcion": "Muestra un mejor detalle cuando los vehiculos tienen una velocidad menor a 10 km/h"
                },
                "sino_horario_trabajo": {
                    "tipo": "boolean",
                    "titulo": "¿Usar horario de trabajo?",
                    "descripcion": "Utiliza el horario configurado para obtener por cada dia los reportes dentro de ese rango."
                },
                "detalle_distancia_recorrida": {
                    "tipo": "boolean",
                    "titulo": "Detalle de distancia recorrida",
                    "descripcion": "Muestra todos los puntos reportados por el equipo en el periodo de fechas seleccionados y agrega las columnas: Odometro, Velocidad y Evento",
                    "valor": "0"
                }
            },
            "columnas_no_seleccionadas": [
                1,
                5,
                8,
                9
            ]
        }
}
```

<details class="mb-m" id="bkmrk-ver-par%C3%A1metros%3A-par%C3%A1"><summary class="text-muted">Ver campos de respuesta:</summary>

<div><div><table class="table" id="bkmrk-campo-descripci%C3%B3n-fo" style="width: 809px; height: 304px;"><tbody><tr style="height: 46px;"><th style="width: 233px; height: 46px;">Campo</th><th style="width: 333px; height: 46px;">Descripción

</th><th style="width: 243px; height: 46px;">Formato</th></tr><tr style="height: 41px;"><td style="width: 233px; height: 41px;">id</td><td style="width: 333px; height: 41px;">Identificador único del reporte.</td><td style="width: 243px; height: 41px;">Entero</td></tr><tr style="height: 41px;"><td style="width: 233px; height: 41px;">nombre</td><td style="width: 333px; height: 41px;">Nombre asignado al reporte.</td><td style="width: 243px; height: 41px;">Cadena de Texto</td></tr><tr style="height: 47px;"><td style="width: 233px; height: 47px;">descripcion</td><td style="width: 333px; height: 47px;">Breve descripción del reporte.

</td><td style="width: 243px; height: 47px;">Cadena de Texto</td></tr><tr style="height: 47px;"><td style="width: 233px; height: 47px;">columnas

</td><td style="width: 333px; height: 47px;">Columnas del reporte.

</td><td style="width: 243px; height: 47px;">Cadena de Texto</td></tr><tr style="height: 47px;"><td style="width: 233px; height: 47px;">filtros

</td><td style="width: 333px; height: 47px;">Filtros del reporte.

</td><td style="width: 243px; height: 47px;">Cadena de Texto</td></tr><tr style="height: 35px;"><td style="height: 35px; width: 233px;">columnas \_no\_seleccionadas

</td><td style="height: 35px; width: 333px;">Columnas no seleccionadas del reporte.

</td><td style="height: 35px; width: 243px;">Entero

</td></tr></tbody></table>

</div></div></details>

# Listar los reportes programados - getProgrammedReports

<span class="api-method" data-method="POST">POST</span> **https://api.service24gps.com/api/v1/onreports/getProgrammedReports**

Este método devuelve el listado de los reportes programados de la plataforma OnReports.

<details class="mb-m" id="bkmrk-body-parametersparam"><summary class="text-muted">Ver parámetros de solicitud:</summary>

<div><table class="table" style="height: 139px;"><tbody><tr style="height: 41px;"><th style="width: 144px; height: 41px;">Parámetros</th><th style="width: 376px; height: 41px;">Descripción</th><th style="width: 289px; height: 41px;">Ejemplo</th></tr><tr style="height: 57px;"><td style="width: 144px; height: 57px;">apikey</td><td style="width: 376px; height: 57px;">**(Requerido)** Llave de autorización para uso de los Servicios Web.</td><td style="width: 289px; height: 57px;"><span role="presentation" style="padding-right: 0.1px; color: #3366ff;">25sdsd234234aa93sdsdsd37c70118e72</span></td></tr><tr style="height: 41px;"><td style="width: 144px; height: 41px;">token</td><td style="width: 376px; height: 41px;">**(Requerido)** Token devuelto por el método **[getToken](https://docs.redgps.com/books/webservice/page/metodo-de-autenticacion-gettoken-7ef).**</td><td style="width: 289px; height: 41px;"><span style="color: #3366ff;">wfszR/oPIQKjt5HT5NgjDnZ2SAZQ==</span></td></tr></tbody></table>

</div></details>##### Solicitud de ejemplo:

```shell
curl --location 'https://api.service24gps.com/api/v1/onreports/getProgrammedReports' \
--form 'apikey="25sdsd234234aa93sdsdsd37c70118e72"' \
--form 'token="wfszR/oPIQKjt5HT5NgjDnZ2SAZQ=="'
```

##### Respuesta de ejemplo:

```JSON
{
    "status": 200,
    "data": [
        {
            "id": "000001",
            "name_report": "Reporte de paradas",
            "attached_format": [
                "XLS",
                "PDF",
                "JSON"
            ],
            "asset_groups": [],
            "assets": {
                "000001": "Activo Simulado 1",
                "000002": "Activo Simulado 2"
            },
            "start_date": "2024-09-25",
            "start_time": "00:00:00",
            "end_date": "2024-09-25",
            "end_time": "23:59:59",
            "time_range": "Hoy",
            "days_to_send_report": [
                "Lunes",
                "Martes",
                "Miércoles",
                "Jueves",
                "Viernes",
                "Sábado",
                "Domingo"
            ],
            "columns": [
                "Activo",
                "Fecha",
                "Hora",
                "Placa",
                "Descripcion",
                "Tiempo parado",
                "Latitud",
                "Longitud",
                "Domicilio",
                "Lugar",
                "Geocerca",
                "Grupo Vehiculo",
                "Ver mapa"
            ],
            "send_report": "1",
            "send_report_email": "test@gmail.com"
        },
        {
            "id": "000002",
            "name_report": "Sensores: Ignición",
            "attached_format": [
                "XLS",
                "PDF",
                "JSON"
            ],
            "asset_groups": [],
            "assets": {
                "000001": "Activo Simulado 1",
                "000002": "Activo Simulado 2"
            },
            "start_date": "2024-09-25",
            "start_time": "00:00:00",
            "end_date": "2024-09-25",
            "end_time": "23:59:59",
            "time_range": "Hoy",
            "days_to_send_report": [
                "Lunes",
                "Martes",
                "Miércoles",
                "Jueves",
                "Viernes",
                "Sábado",
                "Domingo"
            ],
            "columns": [],
            "send_report": "1",
            "send_report_email": "test@gmail.com"
        },
        {
            "id": "000003",
            "name_report": "Seguimiento completo",
            "attached_format": [
                "XLS",
                "PDF"
            ],
            "asset_groups": [],
            "assets": {
                "000001": "Activo Simulado 1",
                "000002": "Activo Simulado 2"
            },
            "start_date": "2024-09-25",
            "start_time": "00:00:00",
            "end_date": "2024-09-25",
            "end_time": "23:59:59",
            "time_range": "Hoy",
            "days_to_send_report": [
                "Lunes",
                "Martes",
                "Miércoles",
                "Jueves",
                "Viernes",
                "Sábado",
                "Domingo"
            ],
            "columns": [
                "Fecha",
                "Hora",
                "Activo",
                "Conductor",
                "Direccion",
                "Orientacion",
                "Velocidad",
                "Evento",
                "Latitud",
                "Longitud",
                "Odometro",
                "Lugar mas cercano",
                "Placa",
                "Temperatura",
                "Temperatura2",
                "Ver mapa",
                "Buffer",
                "TimeStamp",
                "Geocerca"
            ],
            "send_report": "1",
            "send_report_email": "test@gmail.com"
        }
    ]
}
```

<details class="mb-m" id="bkmrk-ver-par%C3%A1metros%3A-par%C3%A1"><summary class="text-muted">Ver campos de respuesta:</summary>

<div><table class="table" id="bkmrk-campo-descripci%C3%B3n-fo" style="width: 809px; height: 416px;"><tbody><tr style="height: 47px;"><th style="width: 174px; height: 47px;">Campo</th><th style="width: 392px; height: 47px;">Descripción

</th><th style="width: 243px; height: 47px;">Formato</th></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">id</td><td style="width: 392px; height: 41px;">Identificador único del reporte programado.

</td><td style="width: 243px; height: 41px;">Entero</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">name\_report</td><td style="width: 392px; height: 41px;">Nombre del reporte programado.</td><td style="width: 243px; height: 41px;">Cadena de Texto</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">attached\_format</td><td style="width: 392px; height: 41px;">Adjuntos que generara el reporte.</td><td style="width: 243px; height: 41px;">Arreglo</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">asset\_groups</td><td style="width: 392px; height: 41px;">Grupos de Activos seleccionados</td><td style="width: 243px; height: 41px;">Arreglo</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">assets</td><td style="width: 392px; height: 41px;">Activos seleccionados.</td><td style="width: 243px; height: 41px;">Arreglo</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">start\_date</td><td style="width: 392px; height: 41px;">Fecha de inicio del reporte.</td><td style="width: 243px; height: 41px;">Cadena de Texto</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">start\_time</td><td style="width: 392px; height: 41px;">Hora de inicio del reporte.</td><td style="width: 243px; height: 41px;">Cadena de Texto</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">end\_date</td><td style="width: 392px; height: 41px;">Fecha final del reporte.</td><td style="width: 243px; height: 41px;">Cadena de Texto</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">end\_time</td><td style="width: 392px; height: 41px;">Hora final del reporte.</td><td style="width: 243px; height: 41px;">Cadena de Texto</td></tr><tr><td style="width: 174px;">time\_range</td><td style="width: 392px;">Rango de fechas de ejecución del reporte.</td><td style="width: 243px;">Cadena de Texto</td></tr><tr><td style="width: 174px;">days\_to\_send\_report</td><td style="width: 392px;">Días de la semana que se enviara el reporte programado.</td><td style="width: 243px;">Arreglo</td></tr><tr><td style="width: 174px;">columns</td><td style="width: 392px;">Columnas seleccionadas.</td><td style="width: 243px;">Arreglo</td></tr><tr><td style="width: 174px;">send\_report</td><td style="width: 392px;">Enviar automáticamente el reporte por correo.</td><td style="width: 243px;">Entero</td></tr><tr><td style="width: 174px;">send\_report\_email</td><td style="width: 392px;">Correo electrónico en donde se enviara el reporte programado.</td><td style="width: 243px;">Cadena de Texto</td></tr></tbody></table>

</div></details>

# Obtener la información del reporte programado - getScheduledReportResult

<span class="api-method" data-method="POST">POST</span> **https://api.service24gps.com/api/v1/onreports/getScheduledReportResult**

Este método devuelve la información de la última ejecución del reporte programado en la plataforma OnReports.

<p class="callout info">**NOTA:** Para enviar la solicitud del método **getScheduledReportResult** es necesario tener seleccionado la opción JSON en el formato del reporte en OnReports.</p>

<details class="mb-m" id="bkmrk-body-parametersparam"><summary class="text-muted">Ver parámetros de solicitud:</summary>

<div><table class="table" style="height: 139px;"><tbody><tr style="height: 41px;"><th style="width: 165px; height: 41px;">Parámetros</th><th style="width: 358px; height: 41px;">Descripción</th><th style="width: 286px; height: 41px;">Ejemplo</th></tr><tr style="height: 57px;"><td style="width: 165px; height: 57px;">apikey</td><td style="width: 358px; height: 57px;">**(Requerido)** Llave de autorización para uso de los Servicios Web.</td><td style="width: 286px; height: 57px;"><span role="presentation" style="padding-right: 0.1px; color: #3366ff;">25sdsd234234aa93sdsdsd37c70118e72</span></td></tr><tr style="height: 41px;"><td style="width: 165px; height: 41px;">token</td><td style="width: 358px; height: 41px;">**(Requerido)** Token devuelto por el método [getToken](https://docs.redgps.com/books/webservice/page/metodo-de-autenticacion-gettoken-7ef).</td><td style="width: 286px; height: 41px;"><span style="color: #3366ff;">wfszR/oPIQKjt5HT5NgjDnZ2SAZQ==</span></td></tr><tr><td style="width: 165px;">report\_id</td><td style="width: 358px;">**(Requerido)** Identificador único del reporte programado.

El id del reporte programado se puede consultar en el método **[getProgrammedReports.](https://docs.redgps.com/books/webservice/page/metodo-para-listar-los-reportes-programados-getprogrammedreports)**

</td><td style="width: 286px;"><span style="color: #3366ff;">000001</span></td></tr></tbody></table>

</div></details>##### Solicitud de ejemplo:

```shell
curl --location 'https://api.service24gps.com/api/v1/onreports/getScheduledReportResult' \
--form 'apikey="25sdsd234234aa93sdsdsd37c70118e72"' \
--form 'token="wfszR/oPIQKjt5HT5NgjDnZ2SAZQ=="' \
--form 'report_id="000001"' 
```

##### Respuesta de ejemplo:

```JSON
{
    "status": 200,
    "headers": {
        "last_execution": "2024-09-25 12:00:00",
        "start_datetime": "2024-09-25 00:00:00",
        "end_datetime": "2024-09-25 23:59:59",
        "execution_id": "87ddc52d2e65e",
        "client_id": "123456",
        "destination_url": "https://google.com/getTestRequest",
        "saved_report_id": "000001",
        "saved_report_name": "Reporte de paradas",
        "report_type": "",
        "selected_assets": {
           	"000001": "Activo Simulado 1",
        	"000002": "Activo Simulado 2"
        },
        "assets_groups": []
    },
    "data": {
        "columns": {
            "IdVehiculo": "Activo",
            "Fecha": "Fecha",
            "Hora": "Hora",
            "Placa": "Placa",
            "Descripcion": "Descripcion",
            "Tiempo_parado": "Tiempo parado",
            "Latitud": "Latitud",
            "Longitud": "Longitud",
            "Domicilio": "Domicilio",
            "Lugar": "Lugar",
            "Geocerca": "Geocerca",
            "grupo_activo": "Grupo Vehiculo",
            "link_gm": "Ver mapa"
        },
        "result": {
            {
            "activo": "Activo",
            "fecha": "2024-09-25",
            "hora": "00:00:00",
            "placa": "Simulado 1",
            "descripcion": "Parado desde 2024-09-25 00:00:00 hasta 2024-09-25 12:00:00",
            "tiempo_parado": "12:00:00",
            "latitud": "19.032639",
            "longitud": "-98.200619",
            "domicilio": "1er Rtno. Osa Menor 2-oficina 301, 72810 San Bernardino Tlaxcalancingo, Pue.",
            "lugar": "Almacen general",
            "geocerca": "Centro de distribución",
            "grupo_activo": "",
            "link_gm": "<a href=\"https://maps.google.com/?ie=UTF8&q=19.018831, -98.266287\" target=\"_blank\">Ver mapa </a>"
          }
        }
    }
}
```

<details class="mb-m" id="bkmrk-ver-par%C3%A1metros%3A-par%C3%A1"><summary class="text-muted">Ver campos de respuesta:</summary>

<div><table class="table" id="bkmrk-campo-descripci%C3%B3n-fo" style="width: 809px; height: 129px;"><tbody><tr style="height: 47px;"><th style="width: 174px; height: 47px;">Campo</th><th style="width: 392px; height: 47px;">Descripción

</th><th style="width: 243px; height: 47px;">Formato</th></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">columns</td><td style="width: 392px; height: 41px;">Columnas del reporte programado.

</td><td style="width: 243px; height: 41px;">JSON</td></tr><tr style="height: 41px;"><td style="width: 174px; height: 41px;">result</td><td style="width: 392px; height: 41px;">Información del reporte programado.</td><td style="width: 243px; height: 41px;">JSON</td></tr><tr><td style="width: 174px;">headers</td><td style="width: 392px;">JSON con información extra del reporte programado.</td><td style="width: 243px;">JSON</td></tr></tbody></table>

</div></details>##### Formato de respuesta headers

<details class="mb-m" id="bkmrk-ver-formatos%3A-format"><summary class="text-muted">Ver formato:</summary>

<div><div><table class="table" style="width: 819px; height: 213px;"><tbody><tr style="height: 41px;"><th style="width: 84px; height: 58px;">Nombre</th><th style="width: 134px; height: 58px;">Descripción </th><th style="width: 279px; height: 58px;">Valor de la propiedad</th><th style="width: 322px; height: 58px;">Ejemplo</th></tr><tr style="height: 58px;"><td style="width: 84px; height: 108px;">**Headers**</td><td style="width: 134px; height: 108px;">Formato de respuesta de la petición.

</td><td style="width: 279px; height: 108px;">- **last\_execution:** Fecha y hora de ultima ejecución del reporte programado.
- **start\_datetime:** Fecha y hora de inicio del reporte programado.
- **end\_datetime:** Fecha y hora final del reporte programado.
- **execution\_id:** Id único del reporte programado.
- **client\_id:** Id cliente sistema.
- **destination\_url:** Url de destino en donde se enviara una petición POST cuando se termine de procesar el reporte programado.
- **saved\_report\_id:** Id del reporte programado.
- **saved\_report\_name:** Nombre del reporte programado.
- **report\_type:** Tipo de reporte.
- **selected\_assets:** Activos seleccionados.
- **assets\_groups:** Grupos de Activos seleccionados.

</td><td style="width: 322px; height: 108px;"><div data-block="true" data-editor="46is8" data-offset-key="es9i-0-0">  
</div><div data-block="true" data-editor="46is8" data-offset-key="dcb9b-0-0"><div data-offset-key="dcb9b-0-0"><span style="color: #3366ff;">{  
 "last\_execution": "2024-09-25 12:00:00",  
 "start\_datetime": "2024-09-25 00:00:00",  
 "end\_datetime": "2024-09-25 23:59:59",  
 "execution\_id": "87ddc52d2e65e",  
 "client\_id": "123456", </span></div><div data-offset-key="dcb9b-0-0"><span style="color: #3366ff;"> "destination\_url": "https://google.com/getTestRequest",  
 "saved\_report\_id": "000001",  
 "saved\_report\_name": "Reporte de paradas",  
 "report\_type": "",  
 "selected\_assets": {  
 "000001": "Activo Simulado 1",  
 "000002": "Activo Simulado 2"  
 },  
 "assets\_groups": \[\]  
}  
</span></div></div></td></tr></tbody></table>

</div></div></details>