> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Cumulocity

> Client-mode REST API connector for a curated Cumulocity IoT slice: measurements, alarms, inventory managed objects, events, and current-user smoke

Technical Preview

## Overview

A client-mode connector for a **curated cloud-IoT** slice of [Cumulocity IoT](https://cumulocity.com/api/core/) covering current-user connectivity and the Hugo catalog #114 POST events:

| Catalog connector event | Entity / path | Notes |
| - | - | - |
| POST measurement/measurements | `POST /measurement/measurements` | Telemetry / sensor readings |
| POST alarm/alarms | `POST /alarm/alarms` | Alarms (severity + status) |
| POST inventory/managedObjects | `POST /inventory/managedObjects` | Devices / assets |
| POST event/events | `POST /event/events` | Discrete device/app events |
| (auth helper) | `GET /user/currentUser` | Authenticated connectivity smoke |

Default `BASE_ADDRESS` is `https://trial.cumulocity.com` (no trailing slash; substitute `{tenant}`). Topics use `cloud-iot/cumulocity/<object>/<verb>`.

See the base guide: [REST API Connectors](/latest/lot-language/routes/rest-api-routes).

> [!NOTE]
>
> **Auth header:** Pass the full `Authorization` value via MQTT JSON field `authorization` — either `Basic <Base64(tenantID/username:password)>` or `Bearer {access_token}` (OAuth 2.0 / OAI-Secure / Cumulocity IdP). On the tenant host URL, the username may omit the `tenantID/` prefix. Prefer Hub secrets (`CUMULOCITY_AUTH`). Never commit real credentials.

> [!NOTE]
>
> This template has not been verified against a live authenticated Cumulocity tenant. Status remains blocked until an authenticated live smoke succeeds (GET current user → 200 and preferred POST → 201).

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — Cumulocity IoT curated slice
# Auth: Authorization via {value.json.authorization} (Basic … or Bearer …)
# BASE_ADDRESS: https://trial.cumulocity.com  → substitute https://{tenant}.cumulocity.com

DEFINE ROUTE CumulocityRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://trial.cumulocity.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT GetCurrentUser
        WITH SOURCE_TOPIC "cloud-iot/cumulocity/user/current"
        WITH DESTINATION_TOPIC "cloud-iot/cumulocity/user/current/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/user/currentUser"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "{value.json.authorization}"
    ADD EVENT CreateMeasurement
        WITH SOURCE_TOPIC "cloud-iot/cumulocity/measurement/create"
        WITH DESTINATION_TOPIC "cloud-iot/cumulocity/measurement/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/measurement/measurements"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "{value.json.authorization}"
        WITH BODY "{payload}"
    ADD EVENT CreateAlarm
        WITH SOURCE_TOPIC "cloud-iot/cumulocity/alarm/create"
        WITH DESTINATION_TOPIC "cloud-iot/cumulocity/alarm/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/alarm/alarms"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "{value.json.authorization}"
        WITH BODY "{payload}"
    ADD EVENT CreateManagedObject
        WITH SOURCE_TOPIC "cloud-iot/cumulocity/inventory/create"
        WITH DESTINATION_TOPIC "cloud-iot/cumulocity/inventory/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/inventory/managedObjects"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "{value.json.authorization}"
        WITH BODY "{payload}"
    ADD EVENT CreateEvent
        WITH SOURCE_TOPIC "cloud-iot/cumulocity/event/create"
        WITH DESTINATION_TOPIC "cloud-iot/cumulocity/event/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/event/events"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "{value.json.authorization}"
        WITH BODY "{payload}"
```

## Example MQTT payloads

**GetCurrentUser:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "authorization": "Basic dGVuYW50L3VzZXI6cGFzc3dvcmQ="
}
```

**CreateMeasurement:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "authorization": "Basic dGVuYW50L3VzZXI6cGFzc3dvcmQ=",
  "payload": "{\"source\":{\"id\":\"12345\"},\"time\":\"2026-10-04T08:00:00.000Z\",\"type\":\"c8y_TemperatureMeasurement\",\"c8y_TemperatureMeasurement\":{\"T\":{\"value\":21.5,\"unit\":\"C\"}}}"
}
```

**CreateAlarm:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "authorization": "Bearer eyJhbGciOiJSUzI1NiJ9...",
  "payload": "{\"source\":{\"id\":\"12345\"},\"time\":\"2026-10-04T08:00:00.000Z\",\"type\":\"c8y_ThresholdAlarm\",\"text\":\"Temp high\",\"severity\":\"MAJOR\",\"status\":\"ACTIVE\"}"
}
```

**CreateManagedObject:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "authorization": "Basic dGVuYW50L3VzZXI6cGFzc3dvcmQ=",
  "payload": "{\"name\":\"Coreflux demo device\",\"type\":\"c8y_Device\",\"c8y_IsDevice\":{}}"
}
```

**CreateEvent:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "authorization": "Basic dGVuYW50L3VzZXI6cGFzc3dvcmQ=",
  "payload": "{\"source\":{\"id\":\"12345\"},\"time\":\"2026-10-04T08:00:00.000Z\",\"type\":\"c8y_LocationUpdate\",\"text\":\"Position update\"}"
}
```

## References

* [Cumulocity OpenAPI (core)](https://cumulocity.com/api/core/)
* [Device integration REST](https://cumulocity.com/docs/device-integration/device-integration-rest/)
* [Microservice REST](https://cumulocity.com/docs/microservice-sdk/rest/)
* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.