Ir al contenido
v2.7

Actualizar tópico

Update a topic by its unique ID.

PATCH/messaging/topics/{topicId}Alcance topics.write

SDK: solo @owbase/node

Update a topic by its unique ID.

topicId string obligatorio

Topic ID.

name string

Topic Name.

subscribe string[]

An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. learn more about roles. Maximum of 100 roles are allowed, each 64 characters long.

qos number

MQTT delivery quality of service for this topic. 0 is fire-and-forget (delivered only to clients connected at publish time). 1 persists each message and replays it when a client reconnects without having acknowledged it. Null lets the subscriber choose.

expiry number

Message retention in seconds for offline delivery. Max 7 days (604800). Null inherits the lowest expiry of the project’s enabled Owbase providers, or the 7-day ledger window if none sets one.

description string

Optional description for the topic.

Acceso: clave de API con el alcance topics.write.

200Éxito
400Parámetro inválido o faltante
401Sin sesión, sin permiso en el recurso o clave sin el alcance
404Recurso de la ruta no encontrado
429Límite de peticiones

Todo error llega como JSON con code, type y message: consulta Errores.

import { Client, Messaging } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const messaging = new Messaging(client);
const result = await messaging.updateTopic({
topicId: '<TOPIC_ID>',
name: '<NAME>', // optional
subscribe: ['any'], // optional
qos: 0, // optional
expiry: 0, // optional
description: '<DESCRIPTION>', // optional
});
Respuesta200 OK
{
"$id": "259125845563242502",
"$createdAt": "2020-10-15T06:38:00.000+00:00",
"$updatedAt": "2020-10-15T06:38:00.000+00:00",
"name": "events",
"description": "Order status updates sent to customers.",
"emailTotal": 100,
"smsTotal": 100,
"pushTotal": 100,
"subscribe": [
"users"
],
"qos": 1,
"expiry": 604800
}

Las descripciones de esta página vienen de la especificación de la API del servidor (licencia BSD-3-Clause), en inglés, y los ejemplos vienen del generador de SDKs (licencia MIT). Los avisos completos están en el archivo NOTICE de los paquetes @owbase/web y @owbase/node.

¿Te ayudó esta página?