Documentación
Comunicaciones
Comunicaciones enviadas a residentes.
type: comunicacion EntitySet: Comunicaciones App: /comunicaciones
Scopes
comunidesk:readcomunidesk:write
Endpoints
GET /v1/rest/Comunicaciones
Listar
Scopes: comunidesk:read
GET /v1/rest/Comunicaciones/{id}
Obtener por id
Scopes: comunidesk:read
POST /v1/rest/Comunicaciones
Crear
Scopes: comunidesk:write
PATCH /v1/rest/Comunicaciones/{id}
Actualizar
Scopes: comunidesk:write
Specs OpenAPI y SOAP
Descarga el contrato del módulo (JSON, YAML o WSDL) para importar en Postman, Insomnia o clientes SOAP.
Ejemplo de request
import Foundation
let oauthToken = "OAUTH_TOKEN"
let userJwt = "USER_JWT"
var req = URLRequest(url: URL(string: "https://gateway.comunidesk.com/v1/rest/Comunicaciones")!)
req.httpMethod = "GET"
req.setValue("Bearer \(oauthToken)", forHTTPHeaderField: "Authorization")
req.setValue("Bearer \(userJwt)", forHTTPHeaderField: "x-comunidesk-user-authorization")
req.setValue("application/json", forHTTPHeaderField: "Accept")
let (data, response) = try await URLSession.shared.data(for: req)
let http = response as! HTTPURLResponse
print(http.statusCode, String(data: data, encoding: .utf8) ?? "")
// scope tipico: comunidesk:readApps nativas (iOS / Android)
Después del login, consulta /v1/me/capabilities y muestra solo los módulos disponibles para ese usuario.
import Foundation
let oauthToken = "OAUTH_TOKEN"
let userJwt = "USER_JWT"
var req = URLRequest(url: URL(string: "https://gateway.comunidesk.com/v1/me/capabilities")!)
req.httpMethod = "GET"
req.setValue("Bearer \(oauthToken)", forHTTPHeaderField: "Authorization")
req.setValue("Bearer \(userJwt)", forHTTPHeaderField: "x-comunidesk-user-authorization")
struct CapName: Decodable { let es: String; let en: String }
struct CapModule: Decodable {
let id: String
let entitySet: String
let canRead: Bool
let canWrite: Bool
let name: CapName
}
struct Capabilities: Decodable { let modules: [CapModule] }
let (data, _) = try await URLSession.shared.data(for: req)
let caps = try JSONDecoder().decode(Capabilities.self, from: data)
let menu = caps.modules.filter { $0.canRead }
// menu.forEach { print($0.name.es, $0.entitySet) }Campos de escritura
Campos aceptados en POST/PATCH.
| Campo | Tipo | Obligatorio | Enum |
|---|---|---|---|
| edificioId | string | Sí | |
| asunto | string | Sí | |
| cuerpo | string | Sí | |
| canal | string | No | email | push | sms | interno |
| destinatarios | array | No | |
| fechaEnvio | string | No |
Solo lectura: _id, _rev, type, createdAt, updatedAt
