Get Message
Endpoint que entrega información de una notificación recibida en un dispositivo, es necesario ingresar tanto el trust_id del dispositivo como el identificador del mensaje (campo llamado message_id).
Los campos action, action_button y error_message son campos que son enviados por el dispositivo y el status que puede tener 3 estados:
- PENDING = 1. Indica que el mensaje está en cola aún y no ha sido recibido por el móvil.
 - SUCCESS = 2. El mensaje fue recibido exitosamente por el móvil.
 - FAIL = 3. Algo ha salido mal y el mensaje no fue recibido con éxito.
 
Endpoint
Headers
| Key | Value | Description | 
|---|---|---|
| Content-Type | application/json | |
| Authorization | Bearer {{access_token}} | access_token obtained in Atenea | 
Url
Method: POST
URL: https://api.trust.lat/notifications/device/notification
caution
Recuerda que para utilizar este endpoint es necesario un access token obtenido en el servicio Atenea
Body
{
	"trust_id": "za0c25-5049-44d6-ad75-974c3807e77f",
	"message_id": "0:1557245892804251%ffe5a0ffee450"
}
Code Examples
- Curl
 - JavaScript
 - Python
 
curl --location --request POST 'https://api.trust.lat/notifications/device/notification' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
	"trust_id": "za0c25-5049-44d6-ad75-974c3807e77f",
	"message_id": "0:1557245892804251%ffe5a0ffee450"
}'
import requests
url = "https://api.trust.lat/notifications/device/notification"
payload="{\n\t\"trust_id\": \"za0c25-5049-44d6-ad75-974c3807e77f\",\n\t\"message_id\": \"0:1557245892804251%ffe5a0ffee450\"\n}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {{accessToken}}'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({"trust_id":"za0c25-5049-44d6-ad75-974c3807e77f","message_id":"0:1557245892804251%ffe5a0ffee450"});
var config = {
  method: 'post',
  url: 'https://api.trust.lat/notifications/device/notification',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer {{accessToken}}'
  },
  data : data
};
axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
Responses
HTTP Code: 200 OK
{
    "status": "success",
    "code": 200,
    "message": "Ok",
    "resource": "Notification",
    "total": 1,
    "data": {
        "id": 999999,
        "uuid": "ada0386-9bce-4c0b-8ffd-7c7b0e45c0c2",
        "device_id": 99999,
        "trust_id": "64a5dm8a-2d5c-448e-bb11-7eb88bd425",
        "message_id": "0:162368298822216%fee45a9fd7ecd",
        "action": "success",
        "error_message": "",
        "type": "sign_document",
        "application_id": 1,
        "status": 2,
        "action_button": null,
        "createdAt": "2021-06-14T15:03:01.859Z",
        "updatedAt": "2021-06-14T15:03:07.148Z"
    }
}
HTTP Code: 200 OK - No Data
{
    "status": "success",
    "code": 200,
    "message": "Ok",
    "resource": "Notification",
    "total": 0,
    "data": {}
}
HTTP Code: 422 Unprocessable Entity
{
    "status": "error",
    "code": 422,
    "message": "Unprocessable Entity",
    "resource": "Device",
    "total": 0,
    "error": [
        {
            "location": "body",
            "param": "trust_id",
            "msg": "trust_id is required",
            "value": ""
        }
    ]
}