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

# Siemens Teamcenter

> Client-mode REST API connector for Siemens Teamcenter: read item revisions, release status and BOMs, find the released drawing of a revision for work instruction display, run saved queries, and turn a quality event into a problem report with a workflow, through Teamcenter's JSON SOA REST services

Technical Preview

## Overview

[Siemens Teamcenter](https://plm.sw.siemens.com/en-US/teamcenter/) is the PLM system that owns parts, revisions, BOMs, drawings and change processes for many plants. This connector lets shop-floor logic on MQTT read the released revision and BOM of a part, find its released drawing for a work instruction screen, and raise a problem report from a quality event, without custom code.

**SiemensTeamcenterApi** (`SiemensTeamcenterRestApi.lot`) is one client connector on `https://YOUR_TC_SERVER` with 18 events: 1 login, 14 reads and 3 writes. No event deletes, revises or checks out anything.

> [!NOTE]
>
> Teamcenter exposes every SOA service operation as JSON over HTTP: `POST /tc/JsonRestServices/<Library>-<YYYY>-<MM>-<Service>/<operation>` with a body of `{"header": {"state": {}, "policy": {}}, "body": {...}}`. Siemens does not publish an OpenAPI file for Teamcenter. Your installation can generate its own API description (Active Workspace `npm run genSoaApi`). The events here follow public samples: the [Teamcenter REST API Postman collection](https://github.com/Krusty84/Teamcenter_REST_API), [TCSwiftBridge](https://github.com/Krusty84/TCSwiftBridge) and the Mendix [Teamcenter connector docs](https://docs.mendix.com/appstore/industry/teamcenter-connector/services-not-included/). To add another operation, copy an event and change the operation path.

## Server host

Teamcenter is installed per customer, or runs as Teamcenter X (SaaS). Replace `YOUR_TC_SERVER` with your web tier host, with no trailing slash. Add the port when the web tier does not use 443 (for example `:7001` or `:8080`). Behind the Active Workspace gateway, the same operations are also served under `/tc/RestServices/` and need an `X-XSRF-TOKEN` header. This template uses `/tc/JsonRestServices/` on the web tier.

## Authentication

> [!WARNING]
>
> Teamcenter sessions act as their user. Keep the user and password in Hub secrets, map them in with `GET SECRET`, and never publish the session cookie on a topic other clients can read.

1. Publish the credentials on `mes/siemens-teamcenter/session/login`. The web tier answers with a `JSESSIONID` cookie (`Set-Cookie`).
2. Send `"cookie": "JSESSIONID=<id>"` in every other payload. One session holds one Teamcenter server process, so reuse it instead of logging in per call.

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "request": {
    "header": {
      "state": {},
      "policy": {}
    },
    "body": {
      "credentials": {
        "user": "<TC user>",
        "password": "<TC password>",
        "role": "",
        "descrimator": "coreflux",
        "locale": "",
        "group": ""
      }
    }
  }
}
```

> [!WARNING]
>
> `JSESSIONID` only comes back in the `Set-Cookie` header, not in the response body. It is not yet verified whether the broker's REST client keeps cookies per connector or passes `Set-Cookie` on. Until that is confirmed, get the session outside the broker and keep the cookie on `internal/siemens-teamcenter/cookie` (the example actions read it there). Sites that use Teamcenter SSO or Teamcenter X log in through Siemens SSO. They need a session from that login flow, which this template does not cover.

## Payload convention

* `request`: the full SOA envelope, sent as the body unchanged. `header.policy` picks which properties come back (`types[].properties[].name`).
* `cookie`: the session cookie, `JSESSIONID=<id>`.
* Objects are referenced as `{"uid": "...", "type": "ItemRevision"}`. Some operations take plain UID strings.

## Events

| Event | Topic | Operation | Kind | What it does |
| - | - | - | - | - |
| `Login` | `mes/siemens-teamcenter/session/login` | `Core-2011-06-Session/login` | Read | Log in with Teamcenter user / password (Core-2011-06-Session/login). The web tier answers with Set-Cookie JSESSIONID; send it as cookie on every other event |
| `GetSessionInfo` | `mes/siemens-teamcenter/session-info/get` | `Core-2007-01-Session/getTCSessionInfo` | Read | Session check: current user, group, role, server version (Core-2007-01-Session/getTCSessionInfo) |
| `GetFavorites` | `mes/siemens-teamcenter/favorites/get` | `Core-2008-03-Session/getFavorites` | Read | Favorites of the session user |
| `GetPreferences` | `mes/siemens-teamcenter/preferences/get` | `Administration-2012-09-PreferenceManagement/getPreferences` | Read | Read Teamcenter preferences by name (for example the default revision rule) |
| `GetItemFromId` | `mes/siemens-teamcenter/item/get` | `Core-2007-01-DataManagement/getItemFromId` | Read | Item and item revision (UIDs and properties) by item\_id and revision id; first call of the BOM and drawing flows |
| `GetProperties` | `mes/siemens-teamcenter/properties/get` | `Core-2006-03-DataManagement/getProperties` | Read | Properties of objects by UID: release\_status\_list / date\_released to check a revision is released, IMAN\_specification / IMAN\_Rendering for its drawing datasets |
| `ExpandGrmRelationsForPrimary` | `mes/siemens-teamcenter/relations-primary/expand` | `Core-2007-09-DataManagement/expandGRMRelationsForPrimary` | Read | Secondary objects of an item revision by relation type (IMAN\_specification, IMAN\_Rendering, ...): find the drawing / PDF datasets for work instruction display |
| `GetSavedQueries` | `mes/siemens-teamcenter/saved-queries/list` | `Query-2006-03-SavedQuery/getSavedQueries` | Read | All saved queries (names and UIDs) |
| `DescribeSavedQueries` | `mes/siemens-teamcenter/saved-queries/describe` | `Query-2006-03-SavedQuery/describeSavedQueries` | Read | Fields (entries) of a saved query |
| `PerformSearch` | `mes/siemens-teamcenter/search/perform` | `Query-2012-10-Finder/performSearch` | Read | Finder search: run a saved query (Awp0SavedQuerySearchProvider) or the inbox (Awp0InboxProvider) with a property policy |
| `GetRevisionRules` | `mes/siemens-teamcenter/revision-rules/list` | `Cad-2007-01-StructureManagement/getRevisionRules` | Read | Revision rules (Latest Working, Any Status; Working, Precise, ...) |
| `CreateBomWindow` | `mes/siemens-teamcenter/bom-window/create` | `Cad-2007-01-StructureManagement/createBOMWindows` | Read | Open a BOM window on an item (revision rule config); returns bomWindow and the top bomLine. Session object only, saves nothing |
| `ExpandBomOneLevel` | `mes/siemens-teamcenter/bom/expand-one-level` | `Cad-2007-01-StructureManagement/expandPSOneLevel` | Read | First-level children of a BOM line (excludeFilter None2) |
| `ExpandBomAllLevels` | `mes/siemens-teamcenter/bom/expand-all-levels` | `Cad-2007-01-StructureManagement/expandPSAllLevels` | Read | Full multi-level BOM below a BOM line, with item revision properties from the policy |
| `CloseBomWindow` | `mes/siemens-teamcenter/bom-window/close` | `Cad-2007-01-StructureManagement/closeBOMWindows` | Read | Close BOM windows opened by CreateBomWindow (frees server memory) |
| `CreateProblemReport` | `mes/siemens-teamcenter/problem-report/create` | `Core-2006-03-DataManagement/createItems` | Write | create an item of a change type such as ProblemReport (createItems; type name per your Change Management template) in a folder |
| `CreateRelations` | `mes/siemens-teamcenter/relations/create` | `Core-2006-03-DataManagement/createRelations` | Write | relate two objects (for example the affected item revision to the problem report; relation type per your template) |
| `StartWorkflow` | `mes/siemens-teamcenter/workflow/start` | `Workflow-2008-06-Workflow/createInstance` | Write | start a workflow process on target objects (for example submit the new problem report for review) |

Replies arrive on `<topic>/response`.

## Flows

### Item revision and BOM

1. `GetItemFromId` with the item ID returns the item and revision UIDs.
2. `CreateBomWindow` with the item UID returns a BOM window and its top BOM line.
3. `ExpandBomOneLevel` or `ExpandBomAllLevels` with the top BOM line returns the children. The property policy in `header.policy` sets which item revision fields come back.
4. `CloseBomWindow` frees the window on the server.

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "cookie": "JSESSIONID=<session id>",
  "request": {
    "header": {
      "state": {},
      "policy": {}
    },
    "body": {
      "infos": [
        {
          "itemId": "PRT-000123",
          "revIds": [
            "A"
          ]
        }
      ],
      "nRev": 1,
      "pref": {}
    }
  }
}
```

### Released drawing for work instruction display

1. `GetItemFromId` returns the revision UID.
2. `GetProperties` on the revision with `release_status_list`, `date_released`, `IMAN_specification` and `IMAN_Rendering` tells you whether the revision is released and which datasets hold its drawing. You can also use `ExpandGrmRelationsForPrimary` with `relationTypeName` `IMAN_specification`.
3. Show the dataset in Active Workspace, or download the file through FMS. File download (`getFileReadTickets` and FMS) is not part of this template.

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "cookie": "JSESSIONID=<session id>",
  "request": {
    "header": {
      "state": {},
      "policy": {}
    },
    "body": {
      "objects": [
        {
          "uid": "<ItemRevision uid>",
          "type": "ItemRevision"
        }
      ],
      "attributes": [
        "object_name",
        "item_revision_id",
        "release_status_list",
        "date_released",
        "IMAN_specification",
        "IMAN_Rendering"
      ]
    }
  }
}
```

### Problem report from a quality event

1. `CreateProblemReport` creates an item of your problem report type (`ProblemReport` in the example) in a folder.
2. `CreateRelations` links the affected revision to the problem report revision.
3. `StartWorkflow` starts your change process template on it.

The type name, relation type and workflow template depend on your Change Management setup. Confirm them with your Teamcenter administrator.

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "cookie": "JSESSIONID=<session id>",
  "request": {
    "header": {
      "state": {},
      "policy": {}
    },
    "body": {
      "properties": [
        {
          "clientId": "coreflux-qe-1",
          "itemId": "",
          "name": "Porosity on PRT-000123 rev A",
          "type": "ProblemReport",
          "revId": "",
          "uom": "",
          "description": "Quality event QE-1001 from line 1 press 01",
          "extendedAttributes": []
        }
      ],
      "container": {
        "uid": "<home or target folder uid>",
        "className": "Folder",
        "type": "Fnd0HomeFolder"
      },
      "relationType": "contents"
    }
  }
}
```

## Example actions

`docs-helper-actions.lot` holds example actions. They log in every 25 minutes with Hub secrets, look up an item or a revision's drawing datasets when a station asks, and create a problem report from a quality event.

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ACTION TcLogin
ON EVERY 25 MINUTES DO
    SET "user" WITH GET SECRET "TC_USER"
    SET "password" WITH GET SECRET "TC_PASSWORD"
    PUBLISH TOPIC "mes/siemens-teamcenter/session/login" WITH { "request": { "header": { "state": {}, "policy": {} }, "body": { "credentials": { "user": {user}, "password": {password}, "role": "", "descrimator": "coreflux", "locale": "", "group": "" } } } }

DEFINE ACTION TcReleasedDrawingLookup
ON TOPIC "porto/line1/station03/work-instruction/revision-uid" DO
    SET "ck" WITH GET TOPIC "internal/siemens-teamcenter/cookie" AS STRING
    SET "rev" WITH PAYLOAD AS STRING
    PUBLISH TOPIC "mes/siemens-teamcenter/properties/get" WITH { "cookie": {ck}, "request": { "header": { "state": {}, "policy": {} }, "body": { "objects": [ { "uid": {rev}, "type": "ItemRevision" } ], "attributes": [ "release_status_list", "date_released", "IMAN_specification", "IMAN_Rendering" ] } } }

DEFINE ACTION TcItemLookup
ON TOPIC "porto/line1/station03/work-instruction/item-id" DO
    SET "ck" WITH GET TOPIC "internal/siemens-teamcenter/cookie" AS STRING
    SET "item" WITH PAYLOAD AS STRING
    PUBLISH TOPIC "mes/siemens-teamcenter/item/get" WITH { "cookie": {ck}, "request": { "header": { "state": {}, "policy": {} }, "body": { "infos": [ { "itemId": {item}, "revIds": [] } ], "nRev": 1, "pref": {} } } }

DEFINE ACTION TcQualityEventToProblemReport
ON TOPIC "porto/line1/press01/quality-event" DO
    SET "ck" WITH GET TOPIC "internal/siemens-teamcenter/cookie" AS STRING
    SET "title" WITH GET JSON "title" IN PAYLOAD AS STRING
    SET "detail" WITH GET JSON "detail" IN PAYLOAD AS STRING
    SET "folder" WITH GET TOPIC "internal/siemens-teamcenter/problem-report-folder-uid" AS STRING
    PUBLISH TOPIC "mes/siemens-teamcenter/problem-report/create" WITH { "cookie": {ck}, "request": { "header": { "state": {}, "policy": {} }, "body": { "properties": [ { "clientId": "coreflux-qe", "itemId": "", "name": {title}, "type": "ProblemReport", "revId": "", "uom": "", "description": {detail}, "extendedAttributes": [] } ], "container": { "uid": {folder}, "className": "Folder", "type": "Fnd0HomeFolder" }, "relationType": "contents" } } }
```

## Not included

* Delete, revise and checkout operations (left out on purpose).
* File download and upload through FMS (binary content).
* BOM edits (`addOrUpdateChildrenToParentLine`, `saveBOMWindows`).
* Teamcenter SSO / Teamcenter X login services and the AWC gateway `/tc/RestServices/` variant.

## Status

**Blocked (beta).** Every event works against a local mock Teamcenter web tier, and the connector passes `lot_lint`. No call has run against a real Teamcenter server. To clear the live test, the factory needs:

* the web tier URL,
* a Teamcenter service user and password (or SSO client details and a way to get `JSESSIONID`),
* a test item with a released revision, a BOM and a drawing.

## Connector file

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — Siemens Teamcenter (beta): read item revisions, properties, release status and BOMs
#   (BOM window + expand one / all levels), find a revision's released drawing datasets for work instruction display,
#   run saved queries / Finder searches, and from a quality event create a problem report, relate the affected
#   revision and start its workflow, over Teamcenter's JSON SOA REST services (/tc/JsonRestServices/).
# Hugo catalog #144, Tier 3 (mes). 18 events (3 writes, no DELETE). No public OpenAPI exists for Teamcenter; events are
#   hand-curated from public samples cached in openapi-cache/siemens-teamcenter/ (see README / meta.json sources).
# Docs: https://docs.coreflux.org/latest/lot-language/routes/rest-api-apps/siemens-teamcenter
#
# Host: Teamcenter is installed per customer (or Teamcenter X SaaS). Replace YOUR_TC_SERVER with the web tier host
#   (add :port, for example :7001 or :8080, when it does not share 443). Operations live under
#   /tc/JsonRestServices/<Library>-<YYYY>-<MM>-<Service>/<operation>; every call is POST with a JSON envelope
#   {"header": {"state": {}, "policy": {}}, "body": {...}}.
# Auth: session. Publish user / password on Login; the web tier returns Set-Cookie JSESSIONID. Send it back as
#   "cookie": "JSESSIONID=<id>" in every other payload. SSO-only sites (Teamcenter SSO / Teamcenter X) need a session
#   obtained outside this route; see the docs. Keep TC user and password in Hub secrets.
# Payloads: "request" is the full SOA envelope sent unchanged as the body; "cookie" is the session cookie.
#     GetItemFromId  {"cookie": "JSESSIONID=...", "request": {"header": {"state": {}, "policy": {}}, "body": {"infos": [{"itemId": "PRT-000123", "revIds": ["A"]}], "nRev": 1, "pref": {}}}}
#

DEFINE ROUTE SiemensTeamcenterApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://YOUR_TC_SERVER"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
        # Smoke: Login -> GetSessionInfo -> GetItemFromId -> GetProperties (release status) -> CreateBomWindow -> ExpandBomOneLevel -> CloseBomWindow. Never commit passwords or session ids.
    # Log in with Teamcenter user / password (Core-2011-06-Session/login). The web tier answers with Set-Cookie JSESSIONID; send it as cookie on every other event
    ADD EVENT Login
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/session/login"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/session/login/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2011-06-Session/login"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.request}"
    # Session check: current user, group, role, server version (Core-2007-01-Session/getTCSessionInfo)
    ADD EVENT GetSessionInfo
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/session-info/get"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/session-info/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2007-01-Session/getTCSessionInfo"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Favorites of the session user
    ADD EVENT GetFavorites
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/favorites/get"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/favorites/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2008-03-Session/getFavorites"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Read Teamcenter preferences by name (for example the default revision rule)
    ADD EVENT GetPreferences
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/preferences/get"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/preferences/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Administration-2012-09-PreferenceManagement/getPreferences"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Item and item revision (UIDs and properties) by item_id and revision id; first call of the BOM and drawing flows
    ADD EVENT GetItemFromId
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/item/get"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/item/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2007-01-DataManagement/getItemFromId"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Properties of objects by UID: release_status_list / date_released to check a revision is released, IMAN_specification / IMAN_Rendering for its drawing datasets
    ADD EVENT GetProperties
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/properties/get"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/properties/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2006-03-DataManagement/getProperties"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Secondary objects of an item revision by relation type (IMAN_specification, IMAN_Rendering, ...): find the drawing / PDF datasets for work instruction display
    ADD EVENT ExpandGrmRelationsForPrimary
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/relations-primary/expand"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/relations-primary/expand/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2007-09-DataManagement/expandGRMRelationsForPrimary"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # All saved queries (names and UIDs)
    ADD EVENT GetSavedQueries
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/saved-queries/list"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/saved-queries/list/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Query-2006-03-SavedQuery/getSavedQueries"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Fields (entries) of a saved query
    ADD EVENT DescribeSavedQueries
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/saved-queries/describe"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/saved-queries/describe/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Query-2006-03-SavedQuery/describeSavedQueries"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Finder search: run a saved query (Awp0SavedQuerySearchProvider) or the inbox (Awp0InboxProvider) with a property policy
    ADD EVENT PerformSearch
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/search/perform"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/search/perform/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Query-2012-10-Finder/performSearch"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Revision rules (Latest Working, Any Status; Working, Precise, ...)
    ADD EVENT GetRevisionRules
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/revision-rules/list"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/revision-rules/list/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Cad-2007-01-StructureManagement/getRevisionRules"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Open a BOM window on an item (revision rule config); returns bomWindow and the top bomLine. Session object only, saves nothing
    ADD EVENT CreateBomWindow
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/bom-window/create"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/bom-window/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Cad-2007-01-StructureManagement/createBOMWindows"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # First-level children of a BOM line (excludeFilter None2)
    ADD EVENT ExpandBomOneLevel
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/bom/expand-one-level"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/bom/expand-one-level/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Cad-2007-01-StructureManagement/expandPSOneLevel"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Full multi-level BOM below a BOM line, with item revision properties from the policy
    ADD EVENT ExpandBomAllLevels
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/bom/expand-all-levels"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/bom/expand-all-levels/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Cad-2007-01-StructureManagement/expandPSAllLevels"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # Close BOM windows opened by CreateBomWindow (frees server memory)
    ADD EVENT CloseBomWindow
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/bom-window/close"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/bom-window/close/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Cad-2007-01-StructureManagement/closeBOMWindows"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # WRITE: create an item of a change type such as ProblemReport (createItems; type name per your Change Management template) in a folder
    ADD EVENT CreateProblemReport
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/problem-report/create"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/problem-report/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2006-03-DataManagement/createItems"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # WRITE: relate two objects (for example the affected item revision to the problem report; relation type per your template)
    ADD EVENT CreateRelations
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/relations/create"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/relations/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Core-2006-03-DataManagement/createRelations"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
    # WRITE: start a workflow process on target objects (for example submit the new problem report for review)
    ADD EVENT StartWorkflow
        WITH SOURCE_TOPIC "mes/siemens-teamcenter/workflow/start"
        WITH DESTINATION_TOPIC "mes/siemens-teamcenter/workflow/start/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/tc/JsonRestServices/Workflow-2008-06-Workflow/createInstance"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Cookie" "{value.json.cookie}"
        WITH BODY "{value.json.request}"
```


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