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

# SAP Digital Manufacturing

> Client-mode REST API connector for a curated SAP Digital Manufacturing Cloud MES slice: SFC start/complete, nonconformance log, quantity confirmation, and order GET

Technical Preview

## Overview

A client-mode connector for a **curated MES / shop-floor** slice of [SAP Digital Manufacturing](https://api.sap.com/package/SAPDigitalManufacturingCloud) (Digital Manufacturing Cloud) public REST APIs on the Business Accelerator Hub, aligned to Hugo catalog **#133**:

| Catalog connector event | API | Path |
| - | - | - |
| POST sfc/v1/sfcs/start | `sapdme_sfc` | `POST /sfc/v1/sfcs/start` |
| POST sfc/v1/sfcs/complete | `sapdme_sfc` | `POST /sfc/v1/sfcs/complete` |
| POST nonconformance | `sapdme_nonconformance` | `POST /nonconformance/v1/log` |
| POST quantityConfirmation | `sapdme_quantityConfirmation` | `POST /quantityConfirmation/v1/confirm` |
| GET order/v1/orders | `sapdme_order` | `GET /order/v1/orders?plant=&order=` |
| (smoke) list plants | `sapdme_plant` | `GET /plant/v1/plants` |
| (smoke) SFC detail | `sapdme_sfc` | `GET /sfc/v1/sfcdetail?plant=&sfc=` |

`BASE_ADDRESS` is the public API host root (`https://api.{regionHost}.dmc.cloud.sap`, no trailing slash). Example placeholder uses `eu20`. Topics use `mes/sap-digital-manufacturing/<object>/<verb>`.

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

> [!NOTE]
>
> **Auth:** OAuth 2.0 **client credentials** from a BTP service key on the SAP Digital Manufacturing subaccount. Exchange at `{url}/oauth/token`, then pass `Authorization: Bearer {value.json.access_token}` on every MQTT payload. Prefer Hub secrets — never commit real tokens. `public-api-endpoint` from the service key must match `BASE_ADDRESS`.

> [!NOTE]
>
> This template has **not** been verified against a live authenticated DMC tenant. Status remains **blocked** until an authenticated live smoke succeeds (prefer GET plants → 200 and GET order or SFC detail → 200).

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — SAP Digital Manufacturing (curated MES slice)
# Auth: Bearer {value.json.access_token} from BTP OAuth client credentials
# BASE_ADDRESS: https://api.eu20.dmc.cloud.sap  → substitute {regionHost}

DEFINE ROUTE SapDigitalManufacturingRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.eu20.dmc.cloud.sap"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Listplants
        WITH SOURCE_TOPIC "mes/sap-digital-manufacturing/plant/list"
        WITH DESTINATION_TOPIC "mes/sap-digital-manufacturing/plant/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/plant/v1/plants"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
    ADD EVENT Startsfc
        WITH SOURCE_TOPIC "mes/sap-digital-manufacturing/sfc/start"
        WITH DESTINATION_TOPIC "mes/sap-digital-manufacturing/sfc/start/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/sfc/v1/sfcs/start"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
        WITH BODY "{payload}"
    ADD EVENT Completesfc
        WITH SOURCE_TOPIC "mes/sap-digital-manufacturing/sfc/complete"
        WITH DESTINATION_TOPIC "mes/sap-digital-manufacturing/sfc/complete/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/sfc/v1/sfcs/complete"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
        WITH BODY "{payload}"
    ADD EVENT Lognonconformance
        WITH SOURCE_TOPIC "mes/sap-digital-manufacturing/nonconformance/log"
        WITH DESTINATION_TOPIC "mes/sap-digital-manufacturing/nonconformance/log/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/nonconformance/v1/log"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
        WITH BODY "{payload}"
    ADD EVENT Quantityconfirmation
        WITH SOURCE_TOPIC "mes/sap-digital-manufacturing/quantity-confirmation/confirm"
        WITH DESTINATION_TOPIC "mes/sap-digital-manufacturing/quantity-confirmation/confirm/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/quantityConfirmation/v1/confirm"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
        WITH BODY "{payload}"
    ADD EVENT Getorder
        WITH SOURCE_TOPIC "mes/sap-digital-manufacturing/order/get"
        WITH DESTINATION_TOPIC "mes/sap-digital-manufacturing/order/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/order/v1/orders?plant={value.json.plant}&order={value.json.order}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
```

## Events

| Event | MQTT request topic | Method | Endpoint |
| - | - | - | - |
| Listplants | `mes/sap-digital-manufacturing/plant/list` | GET | `/plant/v1/plants` |
| Getsfcdetail | `mes/sap-digital-manufacturing/sfc/get` | GET | `/sfc/v1/sfcdetail?plant=&sfc=` |
| Startsfc | `mes/sap-digital-manufacturing/sfc/start` | POST | `/sfc/v1/sfcs/start` |
| Completesfc | `mes/sap-digital-manufacturing/sfc/complete` | POST | `/sfc/v1/sfcs/complete` |
| Lognonconformance | `mes/sap-digital-manufacturing/nonconformance/log` | POST | `/nonconformance/v1/log` |
| Quantityconfirmation | `mes/sap-digital-manufacturing/quantity-confirmation/confirm` | POST | `/quantityConfirmation/v1/confirm` |
| Getorder | `mes/sap-digital-manufacturing/order/get` | GET | `/order/v1/orders?plant=&order=` |

Each request topic has a matching `/response` destination. POST bodies use `{payload}` (full MQTT JSON body forwarded to DMC). Include `access_token` in the JSON for Bearer auth.

### Example MQTT payloads

**GET plants (smoke):**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{ "access_token": "YOUR_BTP_ACCESS_TOKEN" }
```

**Start SFC:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "access_token": "YOUR_BTP_ACCESS_TOKEN",
  "plant": "P001",
  "operation": "10",
  "resource": "RES01",
  "sfcs": ["SFC0001"]
}
```

**GET order:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "access_token": "YOUR_BTP_ACCESS_TOKEN",
  "plant": "P001",
  "order": "1000123"
}
```

## Configuration

| Setting | Value |
| - | - |
| `BASE_ADDRESS` | `https://api.{regionHost}.dmc.cloud.sap` (example `eu20`; no trailing slash) |
| Auth | BTP OAuth 2.0 client credentials → Bearer `access_token` |
| Token URL | `https://{subdomain}.authentication.{region}.hana.ondemand.com/oauth/token` |
| Content-Type | `application/json` |
| SSL | required (`USE_SSL true`) |

Region hosts commonly include `eu10`, `eu20`, `us10`, `us20`, and matching `test.*` hosts. Use the `public-api-endpoint` from your DM service key.

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps](/latest/lot-language/routes/rest-api-apps)
* [SAP Business Accelerator Hub — Digital Manufacturing](https://api.sap.com/package/SAPDigitalManufacturingCloud)
* [SAP Help — APIs for SAP Digital Manufacturing](https://help.sap.com/docs/sap-digital-manufacturing)


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