Documentación
Plan de emergencia
Planes de emergencia del edificio.
type: plan_emergencia EntitySet: PlanEmergencia App: /plan-emergencia
Scopes
comunidesk:readcomunidesk:write
Endpoints
GET /v1/rest/PlanEmergencia
Listar
Scopes: comunidesk:read
GET /v1/rest/PlanEmergencia/{id}
Obtener por id
Scopes: comunidesk:read
POST /v1/rest/PlanEmergencia
Crear
Scopes: comunidesk:write
PATCH /v1/rest/PlanEmergencia/{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/PlanEmergencia")!)
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í | |
| titulo | string | Sí | |
| descripcion | string | Sí | |
| estado | string | No | |
| tiposEmergenciaCubiertos | array | No | |
| planos | array | No | |
| procedimientos | array | No | |
| contactos | array | No | |
| brigadas | array | No | |
| puntosEncuentro | array | No | |
| simulacros | array | No | |
| versionActual | string | No | |
| historialVersiones | array | No | |
| fechaVigenciaDesde | string | No | |
| fechaVigenciaHasta | string | No | |
| proximaRevision | string | No |
Solo lectura: _id, _rev, type, createdAt, updatedAt, creadoPor, creadoPorNombre, aprobadoPor, aprobadoPorNombre, fechaAprobacion
