> ## 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.

# UpKeep

> Client-mode REST API connector for a curated UpKeep v2 slice: list and create work orders

Technical Preview

# UpKeep

Client-mode REST API connector for a curated UpKeep v2 slice: list and create work orders.

* Hub category: **Field service**.
* Base: `https://api.onupkeep.com`

## Template reference

Generated from the shipped broker template `upkeep` (`-routeCode UPKEEP`). It lists every event the template defines.

### Auth

Auth headers used by the template: `Session-Token: Bearer {value.json.api_token}`.

### Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the UpKeep connector | no |
| `BaseUrl` | string | UpKeep base URL without trailing slash (e.g. [https://api.onupkeep.com](https://api.onupkeep.com)) | yes |

`BASE_ADDRESS` default: `https://api.onupkeep.com`.

### Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `Listworkorders` | GET | `/api/v2/work-orders` | `cmms/upkeep/workorders/list` | `cmms/upkeep/workorders/list/response` | `api_token` |
| `Createworkorder` | POST | `/api/v2/work-orders` | `cmms/upkeep/workorders/create` | `cmms/upkeep/workorders/create/response` | `api_token`, `body` |

### Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode UPKEEP"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE UpKeepRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.onupkeep.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Listworkorders
        WITH SOURCE_TOPIC "cmms/upkeep/workorders/list"
        WITH DESTINATION_TOPIC "cmms/upkeep/workorders/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v2/work-orders"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Session-Token" "Bearer {value.json.api_token}"
    ADD EVENT Createworkorder
        WITH SOURCE_TOPIC "cmms/upkeep/workorders/create"
        WITH DESTINATION_TOPIC "cmms/upkeep/workorders/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v2/work-orders"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Session-Token" "Bearer {value.json.api_token}"
        WITH BODY "{value.json.body}"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

### Usage example

Call `Listworkorders` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'cmms/upkeep/workorders/list/response' &
mosquitto_pub -t 'cmms/upkeep/workorders/list' -m '{"api_token": "<api_token>"}'
```


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