# Obtener última posición GPS

Mediante este endpoint, se puede obtener el ultimo dato de posición válido para un dispositivo determinado.&#x20;

Los dispositivos se pueden ver en los endpoints de [Dispositivos](/entidades-basicas/dispositivos.md)

El dato de posición se obtiene haciendo una consulta GET como la que se define a continuación.

<mark style="color:blue;">`GET`</mark> `https://api.persat.com.ar/v1/devices-lasttrackingpoint/device_id`

#### Path Parameters

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

#### 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": {
        "device_id": 104,
        "timestamp": "2022-12-08T10:11:37.000Z",
        "latitude": -34.57554,
        "longitude": -58.56625
    }
}
```

{% endtab %}

{% tab title="404: Not Found No se encontro el dispositivo" %}

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

{% endtab %}

{% tab title="400: Bad Request device\_id no es un número" %}

```javascript
{
    "success": false,
    "error": {
        "status": 400,
        "type": "BAD_REQUEST",
        "userMessage": "'device_id' debe ser un número entero"
    }
}
```

{% endtab %}
{% endtabs %}

### Analizando la Respuesta

```json
{
    "success": true,
    "data": {
        "device_id": 104,
        "timestamp": "2022-12-08T10:11:37.000Z",
        "latitude": -34.57554,
        "longitude": -58.56625
    }
}
```

**device\_id:** Identificador del Dispositivo.&#x20;

**timestamp:** Fecha y horario del ultimo punto GPS

{% hint style="info" %}
Si bien la fecha esta representada en UTC, hay que considerarla en <mark style="color:blue;">**horario local**</mark>. Entonces para el caso del ejemplo, y sin importar si soy un cliente de Argentina, Ecuardor o Mexico, la fecha mostrada representa el día 8 de Diciembre de 2022 a las 11:37 hora de mi país

```
"timestamp": "2022-12-08T10:11:37.000Z",
```

{% endhint %}

**latitude:** Valor de latitud.

**longitude:** Valor de longitud


---

# 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/rastreo-satelital/obtener-ultima-posicion-gps.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.
