# Obtener mensajes - getMessages

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

Lista los mensajes SMS por un rango de fechas.

<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><tr><td style="width: 188px;">fecha\_inicio</td><td style="width: 320px;">Fecha inicio a consultar, si no se manda este parámetro se utiliza la fecha actual. </td><td style="width: 301px;"><span style="color: #3366ff;">2021-11-01</span></td></tr><tr><td style="width: 188px;">fecha\_fin</td><td style="width: 320px;">Fecha fin a consultar, si no se manda este parámetro se utiliza la fecha actual.</td><td style="width: 301px;"><span style="color: #3366ff;">2021-11-02</span></td></tr></tbody></table>

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

```shell
curl --location --request POST 'https://api.service24gps.com/api/v1/getMessages' \
--form 'apikey="25sdsd234234aa93sdsdsd37c70118e72"' \
--form 'token="wfszR/oPIQKjt5HT5NgjDnZ2SAZQ=="' \
--form 'fecha_inicio="2021-11-01"' \
--form 'fecha_fin="2021-11-02"'
```

##### Respuesta de ejemplo:

```JSON
{
    "status": 200,
    "data": [
        {
            "id": "11",
            "fecha_hora": "2021-11-01 14:23:18",
            "destinatario": "2226308920",
            "mensaje": "Mensaje 01",
            "enviado": "1",
            "device": "1740301338",
            "gateway": "My SMS Gateway"
        },
        {
            "id": "12",
            "fecha_hora": "2021-11-02 14:23:10",
            "destinatario": "2226489019",
            "mensaje": "Mensaje 02",
            "enviado": "1",
            "device": "323701090018785",
            "gateway": "My SMS Gateway"
        }
	]
}
```

<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: 782px; height: 543px;"><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 mensaje sms dentro de la plataforma.</td><td style="width: 243px; height: 41px;">Entero</td></tr><tr style="height: 57px;"><td style="width: 174px; height: 57px;">fecha\_hora</td><td style="width: 392px; height: 57px;">Fecha hora que se envió el mensaje de sms (GMT Hora de México centro)</td><td style="width: 243px; height: 57px;">Fecha Hora (Y-m-d H:i:s)

</td></tr><tr style="height: 47px;"><td style="width: 174px; height: 47px;">destinatario</td><td style="width: 392px; height: 47px;">Número telefónico al que se envió el mensaje sms</td><td style="width: 243px; height: 47px;">Cadena de Texto

</td></tr><tr style="height: 47px;"><td style="width: 174px; height: 47px;">mensaje</td><td style="width: 392px; height: 47px;">Texto o contenido que se envió

</td><td style="width: 243px; height: 47px;">Cadena de Texto</td></tr><tr><td style="width: 174px;">enviado</td><td style="width: 392px;">Bandera para validar si se envió el mensaje: 1 = Enviado, 0 = No enviado

</td><td style="width: 243px;">Valor booleano</td></tr><tr style="height: 47px;"><td style="width: 174px; height: 47px;">device</td><td style="width: 392px; height: 47px;">Identificador único del dispositivo (GPS)

</td><td style="width: 243px; height: 47px;">Cadena de Texto</td></tr><tr style="height: 47px;"><td style="width: 174px; height: 47px;">gateway</td><td style="width: 392px; height: 47px;">Servicio SMS Gateway que se utilizó para el envío del mensaje.

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

</div></details>