Skip to main content

Create channel

Endpoint encargado de crear un nuevo "channel" (Los channels son intermediarios entre los mensajes y los dispositivos). Los parámetros que recibe son:

  • company_id
  • app_id
  • name
  • message_type
  • logged_require
  • data_source

El endpoint devuelve el "channel" ingresado como respuesta.

Endpoint#

Headers

KeyValueDescription
Content-Typeapplication/json
AuthorizationBearer {{access_token}}access_token obtained in Atenea
Method: POST
URL: https://api.trust.lat/channels/v1/channels

Body

{
"company_id": "99",
"app_id": "9",
"name": "channel_name",
"message_type": "trust_notification_source",
"logged_required": false,
"data_source": {
"source": "trust_notification",
"id_1_name": "trust_id",
"id_1": "99-9999-99-9999-9-999-99",
"id_2_name": "app_id",
"id_2": "99"
}
}
caution

Recuerda que para utilizar este endpoint es necesario un access token obtenido en el servicio Atenea

Como obtener un access token

Descripción de los campos

KeyRequiredData TypeDescription
company_idtrueStringCampo que identifica a la compañia
app_idfalseStringCampo que identifica la aplicación del channel
nametrueStringNombre del channel a crear
message_typetrueStringCampo para indicar el tipo de mensaje en el channel
logged_requiredfalseBooleanCampo para indicar si la aplicación enlazada al channel creado debe tener sesión iniciada para acceder a este mismo channel
data_sourcetrueJSON ObjectObjeto encargado de indicar la fuente de información de los mensajes

Descripción del campo data_source

KeyRequiredData TypeDescription
sourcetrueStringCampo que indica el origen de la información
id_1trueStringIdentificador del mensaje en el data_source definido
id_1_nametrueStringCampo que indica qué tipo de id es el campo id_1
id_2falseStringIdentificador del mensaje en el data_source definido
id_2_namefalseStringCampo que indica qué tipo de id es el campo id_2

Code Examples#

curl --location --request POST 'https://api.trust.lat/channels/v1/channels' \
--header 'Authorization: Bearer 4quUDNDnCiK...' \
--header 'Content-Type: application/json' \
--data-raw '{
"company_id": "99",
"app_id": "9",
"name": "channel_name",
"message_type": "trust_notification_source",
"logged_required": false,
"data_source": {
"source": "trust_notification",
"id_1_name": "trust_id",
"id_1": "99-9999-99-9999-9-999-99",
"id_2_name": "app_id",
"id_2": "99"
}
}'

Responses#

HTTP CODE: 201 CREATED#

{
"code": 201,
"resource": "Channel",
"data": {
"app_id": "9",
"company_id": "1",
"created_at": "2020-09-15T04:50:16.206Z",
"data_source": {
"created_at": null,
"id_1": "999999-9999999-9999-99999-999",
"id_1_name": "trust_feed_uuid",
"source": "trust_feed",
"updated_at": null
},
"message_type": "trust_feed_panel",
"name": "prueba",
"updated_at": "2020-09-15T04:50:16.206Z",
"uuid": "999999-9999999-9999-99999-999"
},
"message": "Created"
}
Last updated on by msepulvedav