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

# Rockwell Plex Smart Manufacturing Platform

> Client-mode REST API connector for Rockwell Automation Plex: read workcenters, status and downtime history, production and scrap entries, jobs, parts, containers, equipment and quality plans, and post workcenter status, job setup, batch production, checksheets and container scrap from the shop floor

Technical Preview

## Overview

One client-mode connector, **RockwellPlex**, for the Plex Connect REST APIs of the Rockwell Automation Plex Smart Manufacturing Platform (Plex MES, ERP and quality). It covers what a broker typically exchanges with Plex on a discrete production line.

Read workcenter definitions and their live setup, the status and downtime history, production and scrap records, batches, scheduled jobs, parts, inventory containers, equipment and quality control plans into your Unified Namespace. In the other direction, a PLC state change on the broker can set a workcenter's status in Plex (downtime), set up the next job, record batch production, add a checksheet with measurements, or scrap a container.

| Event | Request | Notes |
| - | - | - |
| ListWorkcenters | `GET /production/v1/production-definitions/workcenters?{query}` | Filter by `workcenterCode`, `name`, `workcenterGroup`, `buildingId`, `plcName`, `ipAddress` |
| GetWorkcenter | `GET /production/v1/production-definitions/workcenters/{workcenter_id}` | One workcenter definition |
| GetWorkcenterSetup | `GET /production/v1/control/workcenters/{workcenter_id}` | Live setup: current job, part, status |
| ListWorkcenterStatuses | `GET /production/v1/production-definitions/workcenter-statuses?{query}` | Status ids for `SetWorkcenterStatus` |
| ListWorkcenterEvents | `GET /production/v1/production-definitions/workcenter-events?{query}` | Event (reason) ids |
| ListWorkcenterStatusEntries | `GET /production/v1/production-history/workcenter-status-entries?{query}` | Status and downtime history; `beginDate`, `endDate` required |
| ListProductionEntries | `GET /production/v1/production-history/production-entries?{query}` | Production records; `beginDate`, `endDate` required |
| ListProductionEntriesSummary | `GET /production/v1/production-history/production-entries-summary?{query}` | Summarised production |
| ListScrapEntries | `GET /production/v1/production-history/scrap-entries?{query}` | Scrap records; `beginDate`, `endDate` required |
| ListBatches | `GET /production/v1/control/workcenters/{workcenter_id}/batches?{query}` | Batches on a workcenter |
| GetNextBatch | `GET /production/v1/control/workcenters/{workcenter_id}/next-batch?{query}` | Next batch to produce |
| ListJobs | `GET /scheduling/v1/jobs?{query}` | Filter by `jobStatuses`, `partId`, `buildingId`, due dates |
| GetJob | `GET /scheduling/v1/jobs/{job_id}` | One job |
| ListJobOperations | `GET /scheduling/v1/jobs/{job_id}/operations?{query}` | Operations of a job; ids for `SetupJob` |
| ListParts | `GET /mdm/v2/parts?{query}` | Part master data |
| ListContainers | `GET /inventory/v1/inventory-tracking/containers?{query}` | Inventory containers |
| ListEquipment | `GET /maintenance/v1/equipment?{query}` | Equipment records |
| ListControlPlans | `GET /quality/v1/control-plans?{query}` | Quality control plans |
| GetChecksheet | `GET /quality/v1/checksheets/{checksheet_id}` | One checksheet |
| SetWorkcenterStatus | `POST /production/v1/control/workcenters/{workcenter_id}/status` | Downtime or running status |
| SetupJob | `POST /production/v1/control/workcenters/{workcenter_id}/setup-job` | Set up a job operation on a workcenter |
| RecordBatchProduction | `POST /production/v1/control/workcenters/{workcenter_id}/record-batch-production` | Record produced quantity for a batch |
| CreateChecksheet | `POST /quality/v1/checksheets` | Add a checksheet with measurements (`201`) |
| ScrapContainer | `POST /inventory/v1/inventory-control/containers/{serial_no}/scrap` | Scrap quantity from a container (`204`) |

Topics are `mes/rockwell-plex-smart-manufacturing-platform/<object>/<verb>`; every reply goes to `<topic>/response`.

## Authentication

Every event sends `X-Plex-Connect-Api-Key: {api_key}`. The key is the Consumer Key of an app you create under **My Apps** in the [Plex Developer Portal](https://developers.plex.com/), subscribed to the API products this connector uses: Production Operations Management, Job Scheduling, Parts, Inventory Operations Management, Equipment, Control Plans and Checksheet. Access to the portal requires Plex IAM, which your Plex Champion arranges through a support case.

Keep the key in a broker secret (suggested `PLEX_CONNECT_API_KEY`) and map it in with `GET SECRET`. Requests run against the key's default tenant (PCN). To work with another PCN, add `ADD "X-Plex-Connect-Tenant-Id" "{value.json.tenant_id}"` under `WITH HEADERS` and send `tenant_id` in the payload.

Plex has a test tier at `https://test.connect.plex.com`, and test and production keys must be different. A missing or wrong key, including a production key used on the test tier, returns `401` with `REQUEST_NOT_AUTHENTICATED`. An app that is not subscribed to an API product gets `403`.

## Basic Syntax

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE RockwellPlex WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://connect.plex.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT ListProductionEntries
        WITH SOURCE_TOPIC "mes/rockwell-plex-smart-manufacturing-platform/production-entry/list"
        WITH DESTINATION_TOPIC "mes/rockwell-plex-smart-manufacturing-platform/production-entry/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/production/v1/production-history/production-entries?{value.json.query}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "X-Plex-Connect-Api-Key" "{value.json.api_key}"
    ADD EVENT SetWorkcenterStatus
        WITH SOURCE_TOPIC "mes/rockwell-plex-smart-manufacturing-platform/workcenter-status/set"
        WITH DESTINATION_TOPIC "mes/rockwell-plex-smart-manufacturing-platform/workcenter-status/set/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/production/v1/control/workcenters/{value.json.workcenter_id}/status"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "X-Plex-Connect-Api-Key" "{value.json.api_key}"
        WITH BODY "{value.json.body}"
```

Use `https://test.connect.plex.com` as `BASE_ADDRESS` while you develop. The full template, with all 24 events, is `RockwellPlexSmartManufacturingPlatformRestApi.lot` in the REST API app.

## MQTT examples

Request bodies go under `body`, so control fields like `api_key`, `workcenter_id` and `query` are not sent to Plex. Ids are Plex GUIDs.

**Find a workcenter by code**: publish to `mes/rockwell-plex-smart-manufacturing-platform/workcenter/list`:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "api_key": "<Plex Consumer Key>",
  "query": "workcenterCode=PRESS-01"
}
```

**Read this shift's production**: publish to `mes/rockwell-plex-smart-manufacturing-platform/production-entry/list`. Plex requires `beginDate` and `endDate`, and the query must be URL-encoded:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "api_key": "<Plex Consumer Key>",
  "query": "beginDate=2026-10-05T06:00:00Z&endDate=2026-10-05T14:00:00Z&workcenterId=<workcenter uuid>"
}
```

Send `"query": ""` on list events when you do not need filters.

**Put a workcenter into downtime**: look up the status id with `workcenter-status/list`, then publish to `mes/rockwell-plex-smart-manufacturing-platform/workcenter-status/set`:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "api_key": "<Plex Consumer Key>",
  "workcenter_id": "<workcenter uuid>",
  "body": { "workcenterStatusId": "<status uuid>", "workcenterEventId": "<optional reason uuid>" }
}
```

**Record batch production**: publish to `mes/rockwell-plex-smart-manufacturing-platform/batch-production/record` with `"body": { "batchId": "<batch uuid>", "quantity": 12 }`. Get the batch id from `batch/next` or `batch/list`.

**Scrap from a container**: publish to `mes/rockwell-plex-smart-manufacturing-platform/container/scrap` with `"serial_no": "<container serial>"` and `"body": { "scrapReason": "<reason>", "quantity": 1 }`. Plex answers `204` with an empty body.

## Helper actions

Keep the key in a broker secret, read a workcenter's live setup every minute, and turn a PLC status change into a Plex workcenter status:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ACTION PlexPollWorkcenterStatus
ON EVERY 1 MINUTE DO
    SET "key" WITH GET SECRET "PLEX_CONNECT_API_KEY"
    PUBLISH TOPIC "mes/rockwell-plex-smart-manufacturing-platform/workcenter-setup/get" WITH { "api_key": {key}, "workcenter_id": "<workcenter uuid>" }

DEFINE ACTION PlexDowntimeFromLine
ON TOPIC "porto/line1/press01/plex-status" DO
    SET "key" WITH GET SECRET "PLEX_CONNECT_API_KEY"
    SET "status" WITH GET JSON "workcenterStatusId" IN PAYLOAD AS STRING
    PUBLISH TOPIC "mes/rockwell-plex-smart-manufacturing-platform/workcenter-status/set" WITH { "api_key": {key}, "workcenter_id": "<workcenter uuid>", "body": { "workcenterStatusId": {status} } }
```

Restrict who can publish to `mes/rockwell-plex-smart-manufacturing-platform/#` with a rule: its payloads carry the API key, and the POST events change production records.

## Notes

* Errors come back on the response topic: `401 REQUEST_NOT_AUTHENTICATED` for a missing or wrong key, `403` when the app is not subscribed to that API product, `404` for an unknown id, `400` with the failing fields for a validation error, and `429` when you hit Plex rate limits.
* Plex history endpoints need a date range. Keep ranges short (one shift) and page by time to stay inside rate limits.
* Status and event ids differ per tenant. Read `workcenter-status/list` and `workcenter-event/list` once and keep the ids in a model or broker configuration.
* `CreateChecksheet` needs `operationId`, `inspectionMode` and `measurements`; take the field names from the control plan (`control-plan/list`) and the Checksheet API in the Plex portal.
* Plex publishes many more APIs (sales orders, purchasing, EDI, accounting, digital work instructions, Plex APM). Add events for them the same way: one `ADD EVENT` per operation, with the path from the Developer Portal.

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API app templates](/latest/lot-language/routes/rest-api-apps/index)
* [Siemens Opcenter Execution](/latest/lot-language/routes/rest-api-apps/siemens-opcenter-execution)
* [SAP Digital Manufacturing](/latest/lot-language/routes/rest-api-apps/sap-digital-manufacturing)


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