MS Notificaciones
Bienvenido al API de MS Notificaciones, aquí encontrarás toda la información relacionada a los endpoints disponibles.
Autenticación
El API usa oAuth2 para la autenticación, esto significa que todas las llamadas al API deben contener una autorización como se detalla abajo.
Authorization: Bearer API_KEY
Consulte la documentación de autenticación para saber cómo obtener un token de acceso.
Headers
Asegúrese de tener los siguientes encabezados de content type en cada solicitud:
Content-Type: application/json
Errors
The API uses conventional HTTP response codes to indicate the success or failure of an API request. The table below contains a summary of the typical response codes:
Code | Description |
---|---|
200 | Everything is ok. |
400 | Valid data was given but the request has failed. |
401 | No valid API Key was given. |
404 | The request resource could not be found. |
405 | The method is not implemented |
422 | The payload has missing required parameters or invalid data was given. |
429 | Too many attempts. |
500 | Request failed due to an internal error. |
503 | API is offline for maintenance. |
API de Usuario ¶
Generar Access Token ¶
Generar Access TokenPOST/oauth/token
Este endpoint permitirá generar un token de autenticación que será necesario para usar las demás peticiones del API.
Este token expira en 10 horas a partir de su creación.
Example URI
Headers
Content-Type: application/x-www-form-urlencoded
Body
{
"client_id": 2,
"client_secret": "eyJ0eXAiOiJKV1Qi...",
"grant_type": "password",
"username": "admin@admin.com",
"password": "12345678"
}
Schema
{
"type": "object",
"properties": {
"client_id": {
"type": "number"
},
"client_secret": {
"type": "string"
},
"grant_type": {
"type": "string"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"client_id",
"client_secret",
"grant_type",
"username",
"password"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
200
Headers
Content-Type: application/json
Body
{
"token_type": "Bearer",
"expires_in": 36000,
"access_token": "eyJ0eXAiOiJKV1Qi...",
"refresh_token": "eyJ0eXAiOiJKV1Qi..."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"token_type": {
"type": "string"
},
"expires_in": {
"type": "number"
},
"access_token": {
"type": "string"
},
"refresh_token": {
"type": "string"
}
}
}
401
Headers
Content-Type: application/json
Body
{
"message": "Unauthenticated.",
"status_code": 401
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
},
"status_code": {
"type": "number"
}
}
}
403
Headers
Content-Type: application/json
Body
{
"message": "Forbidden",
"status_code": 403
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
},
"status_code": {
"type": "number"
}
}
}
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not found",
"status_code": 404
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
},
"status_code": {
"type": "number"
}
}
}
API Registo de Token de Dispositivo ¶
Registrar Token ¶
Registrar TokenPOST/api/userDevices/
Este endpoint permite registrar un nuevo token de usuario para notificaciones.
Example URI
Headers
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1....
Body
{
"user_uid": "6EkRJNHpmrYf7Liur2WXu5HjgFH3",
"device_token": "f3e8561f2e5d84a0",
"email": "prueba@prueba.com",
"origin": "WEB",
"groups": [
"asdvfj3472kjdn",
"asdvfj3472kjdn"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"user_uid": {
"type": "string"
},
"device_token": {
"type": "string"
},
"email": {
"type": "string"
},
"origin": {
"type": "string",
"enum": [
"WEB",
"ANDROID",
"IOS"
]
},
"groups": {
"type": "array"
}
},
"required": [
"user_uid",
"device_token",
"email",
"origin"
]
}
200
Headers
Content-Type: application/json
Body
{
"user_uid": "6EkRJNHpmrYf7Liur2WXu5HjgFH3",
"device_token": "f3e8561f2e5d84a0",
"origin": "WEB",
"created_at": "2018-04-07 21:45:23"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"user_uid": {
"type": "string"
},
"device_token": {
"type": "string"
},
"origin": {
"type": "string",
"enum": [
"WEB",
"ANDROID",
"IOS"
]
},
"created_at": {
"type": "string"
}
},
"required": [
"user_uid",
"device_token",
"origin"
]
}
400
Headers
Content-Type: application/json
Body
{
"message": "Bad Request"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"errors": {
"field_name": "\"Campo xxxxxx obligatorio.\""
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"errors": {
"type": "object",
"properties": {
"field_name": {
"type": "string"
}
}
}
}
}
Desvincular dispositivo ¶
Desvincular dispositivoPUT/api/userDevices/unsuscribe/uid/{uid}/deviceToken/{deviceToken}
Este endpoint permite desvincular un usuario de un dispositivo.
Example URI
- uid
string
(required) Example: 6EkRJNHpmrYf7Liur2WXu5HjgFH3- deviceToken
string
(required) Example: f3e8561f2e5d84a0
Headers
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1....
204
Headers
Content-Type: application/json
400
Headers
Content-Type: application/json
Body
{
"message": "Bad Request"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"errors": {
"field_name": "\"Campo xxxxxx obligatorio.\""
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"errors": {
"type": "object",
"properties": {
"field_name": {
"type": "string"
}
}
}
}
}
Activar/Desactivar Notificaciones ¶
Activar/Desactivar NotificacionesPUT/api/userDevices/uid/{uid}/deviceToken/{deviceToken}
Este endpoint permite al usuario activar o desactivar las notificaciones push en su dispositivo.
Example URI
- uid
string
(required) Example: 6EkRJNHpmrYf7Liur2WXu5HjgFH3- deviceToken
string
(required) Example: f3e8561f2e5d84a0
Headers
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1....
Body
{
"sending_email_enabled": true,
"sending_push_enabled": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"sending_email_enabled": {
"type": "boolean"
},
"sending_push_enabled": {
"type": "boolean"
}
},
"required": [
"sending_email_enabled",
"sending_push_enabled"
]
}
200
Headers
Content-Type: application/json
Body
{
"user_uid": "6EkRJNHpmrYf7Liur2WXu5HjgFH3",
"device_token": "f3e8561f2e5d84a0",
"origin": "WEB",
"created_at": "2018-04-07 21:45:23"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"user_uid": {
"type": "string"
},
"device_token": {
"type": "string"
},
"origin": {
"type": "string",
"enum": [
"WEB",
"ANDROID",
"IOS"
]
},
"created_at": {
"type": "string"
}
},
"required": [
"user_uid",
"device_token",
"origin"
]
}
400
Headers
Content-Type: application/json
Body
{
"message": "Bad Request"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"errors": {
"field_name": "\"Campo xxxxxx obligatorio.\""
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"errors": {
"type": "object",
"properties": {
"field_name": {
"type": "string"
}
}
}
}
}
API de Notificaciones ¶
Obtener Notificaciones https gate io
Obtener NotificacionesGET/api/notifications/uid/{uid}/notificationType/{notificationType}/size/{size}?page={page}
Este endpoint permitirá obtener las notificaciones ingresadas.
Example URI
- uid
string
(required) Example: 12Ae8pe39HZilRpwSZLi9khfyys1- notificationType
number
(required) Example: 3- size
number
(required) Example: 3- page
number
(required) Example: 1
Headers
Content-Type: application/json
200
Headers
Content-Type: application/json
Body
{
"code": "200",
"status": "success",
"message": "Se procesó exitosamente",
"data": {
"first_page_url": 1,
"from": 1,
"last_page": 1,
"last_page_url": "http://notifications.dev/api/notifications/uid/12Ae8pe39HZilRpwSZLi9khfyys1/size/3?page=1",
"next_page_url": "null",
"per_page": "3",
"prev_page_url": "null",
"total": 15,
"itemsPagination": [
{
"title": "Estás cerca de convertirte en una Amigo de Corazón.",
"description": "Descripción.",
"listTitle": "Solo necesitas:",
"ListItems": [
{
"title": "100 puntos más.",
"description": "Acércate a una tienda y realiza consumos para acumular más puntos."
}
],
"creationDate": "2018-04-02 21:40:08",
"priority": "LOW",
"read": "NO"
}
]
},
"warning": [],
"error": []
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"first_page_url": {
"type": "number"
},
"from": {
"type": "number"
},
"last_page": {
"type": "number"
},
"last_page_url": {
"type": "string"
},
"next_page_url": {
"type": "string"
},
"per_page": {
"type": "string"
},
"prev_page_url": {
"type": "string"
},
"total": {
"type": "number"
},
"itemsPagination": {
"type": "array"
}
}
},
"warning": {},
"error": {}
}
}
400
Headers
Content-Type: application/json
Body
{
"code": "400",
"status": "error",
"message": "Error de procesamiento",
"data": [],
"warning": [],
"error": [
{
"code": "null",
"field": "field_name",
"message": "Error description"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {},
"warning": {},
"error": {
"type": "array"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"code": "422",
"status": "error",
"message": "Error de validación",
"data": [],
"warning": [
{
"code": "null",
"field": "field_name",
"message": "Error description"
}
],
"error": []
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {},
"warning": {
"type": "array"
},
"error": {}
}
}
Crear Notificación ¶
Crear NotificaciónPOST/api/notifications/
Este endpoint permite crear una notificación.
Example URI
Headers
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1....
Body
{
"uids": [
{
"uid": "LJ3aQ3GPIjbfdBkGqFlNSu9bPHm2"
},
{
"uid": "6EkRJNHpmrYf7Liur2WXu5HjgFH3"
}
],
"title": "Utilizaste 250 puntos.",
"description": "Se han descontado 24 pts. de tu cuenta, sigue disfrutando con amigos y gana más puntos.",
"listTitle": "null",
"listItems": [
{
"title": "100 puntos más.",
"description": "Acércate a una tienda y realiza consumos para acumular más puntos."
}
],
"priorityId": "3",
"notificationTypeId": "1",
"alertType": "PROMOTED"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"uids": {
"type": "array"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"listTitle": {
"type": "string"
},
"listItems": {
"type": "array"
},
"priorityId": {
"type": "string"
},
"notificationTypeId": {
"type": "string"
},
"alertType": {
"type": "string",
"enum": [
"PROMOTED",
"DEMOTED",
"BIRTHDAY",
"WELCOME",
"REFERRED"
]
}
},
"required": [
"uids",
"title",
"priorityId",
"notificationTypeId"
]
}
200
Headers
Content-Type: application/json
Body
{
"code": "200",
"status": "success",
"message": "Se procesó exitosamente",
"data": {
"uid": "040Jp7fphSXpIwHch7UDblsrFnl1",
"title": "Utilizaste 250 puntos.",
"description": "Se han descontado 24 pts. de tu cuenta, sigue disfrutando con amigos y gana más puntos.",
"listTitle": "null",
"listItems": [
{
"title": "100 puntos más.",
"description": "Acércate a una tienda y realiza consumos para acumular más puntos."
}
],
"priority": "HIGH",
"notificationType": "HIGH",
"read": "YES",
"alertType": "PROMOTED",
"creationDate": "2018-04-07 21:45:23",
"pushResponse": [
"{\\\"multicast_id\\\":5307564197363169915,\\\"success\\\":0,\\\"failure\\\":1,\\\"canonical_ids\\\":0,\\\"results\\\":[{\\\"error\\\":\\\"InvalidRegistration\\\"}]}"
]
},
"warning": [],
"error": []
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"listTitle": {
"type": "string"
},
"listItems": {
"type": "array"
},
"priority": {
"type": "string"
},
"notificationType": {
"type": "string"
},
"read": {
"type": "string"
},
"alertType": {
"type": "string",
"enum": [
"PROMOTED",
"DEMOTED",
"BIRTHDAY",
"WELCOME",
"REFERRED"
]
},
"creationDate": {
"type": "string"
},
"pushResponse": {
"type": "array"
}
},
"required": [
"uid",
"title"
]
},
"warning": {},
"error": {}
}
}
400
Headers
Content-Type: application/json
Body
{
"code": "400",
"status": "error",
"message": "Error de procesamiento",
"data": [],
"warning": [],
"error": [
{
"code": "null",
"field": "field_name",
"message": "Error description"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {},
"warning": {},
"error": {
"type": "array"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"code": "422",
"status": "error",
"message": "Error de validación",
"data": [],
"warning": [
{
"code": "null",
"field": "field_name",
"message": "Error description"
}
],
"error": []
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {},
"warning": {
"type": "array"
},
"error": {}
}
}
Actualizar Estado Leído de Notificación ¶
Actualizar Estado Leído de NotificaciónPUT/api/notifications/read
Este endpoint permite actualizar el estado de leído (YES) de una notificación.
Example URI
Headers
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1....
Body
{
"Notifications": [
{
"id": 1
},
{
"id": 2
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"Notifications": {
"type": "array"
}
},
"required": [
"Notifications"
]
}
200
Headers
Content-Type: application/json
Body
{
"code": "200",
"status": "success",
"message": "Se procesó exitosamente",
"data": {
"uid": "040Jp7fphSXpIwHch7UDblsrFnl1",
"title": "Utilizaste 250 puntos.",
"description": "Se han descontado 24 pts. de tu cuenta, sigue disfrutando con amigos y gana más puntos.",
"listTitle": "null",
"listItems": [
{
"title": "100 puntos más.",
"description": "Acércate a una tienda y realiza consumos para acumular más puntos."
}
],
"priority": "HIGH",
"notificationType": "HIGH",
"read": "YES",
"alertType": "PROMOTED",
"creationDate": "2018-04-07 21:45:23",
"pushResponse": [
"{\\\"multicast_id\\\":5307564197363169915,\\\"success\\\":0,\\\"failure\\\":1,\\\"canonical_ids\\\":0,\\\"results\\\":[{\\\"error\\\":\\\"InvalidRegistration\\\"}]}"
]
},
"warning": [],
"error": []
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"listTitle": {
"type": "string"
},
"listItems": {
"type": "array"
},
"priority": {
"type": "string"
},
"notificationType": {
"type": "string"
},
"read": {
"type": "string"
},
"alertType": {
"type": "string",
"enum": [
"PROMOTED",
"DEMOTED",
"BIRTHDAY",
"WELCOME",
"REFERRED"
]
},
"creationDate": {
"type": "string"
},
"pushResponse": {
"type": "array"
}
},
"required": [
"uid",
"title"
]
},
"warning": {},
"error": {}
}
}
400
Headers
Content-Type: application/json
Body
{
"code": "400",
"status": "error",
"message": "Error de procesamiento",
"data": [],
"warning": [],
"error": [
{
"code": "null",
"field": "field_name",
"message": "Error description"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {},
"warning": {},
"error": {
"type": "array"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"code": "422",
"status": "error",
"message": "Error de validación",
"data": [],
"warning": [
{
"code": "null",
"field": "field_name",
"message": "Error description"
}
],
"error": []
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {},
"warning": {
"type": "array"
},
"error": {}
}
}