Skip to content

Asset Modeler Async API Service – Samples

The code examples given in this section are just .json representations of the Asset Model including the mappings.

Topic Structure

MQTT Broker for MindSphere offers topics described below:

EU1

<designator>/<tenantId>/<clientId>/<direction>/<app>_<version>/<app_topic>

<designator>: [tc]

  • tc: tenant-client topic structure

<tenantId>: tenant id

<clientId>: Unique client id.

<direction>: [i|o]

  • i: inbound. Clients can subscribe.
  • o: outbound. Clients can publish

<app>: Registered application topic name.

<version>: Version of application

<app_topic>: App specific sub topics.

PUBLISH : tc/<tenantId>/<clientId>/o/amo_v3/m

  • Models are templates describing asset/aspect types, asset instances, asset hierarchy and mappings from data point ids to variables in aspects.

SUBSCRIBE : tc/<tenantId>/<clientId>/i/amo_v3/ms

  • Receive model creation results for a previous model request.

PUBLISH : tc/<tenantId>/<clientId>/o/amo_v3/i

  • Instantiations are the realization of models. An instantiation job takes a model and creates the items described in the model by creating types, instances and mappings. A model can be instantiated many times.

SUBSCRIBE : tc/<tenantId>/<clientId>/i/amo_v3/ip

  • Receive instantiation job results for a previous instantiation request.

EU2

Topic Structure for PUBLISH

devices/<clientId>/messages/events/<propertyBag>

<clientId>: Unique client id.

<propertyBag>: Property bag should contains application topic name, version and application specific sub topic.

Topic Structure for SUBSCRIBE

devices/<clientId>/messages/devicebound/#

<clientId>: Unique client id.

PUBLISH : devices/<clientId>/messages/events/amo_v3=m

  • Models are templates describing asset/aspect types, asset instances, asset hierarchy and mappings from data point ids to variables in aspects.

PUBLISH : devices/<clientId>/messages/events/amo_v3=i

  • Instantiations are the realization of models. An instantiation job takes a model and creates the items described in the model by creating types, instances and mappings. A model can be instantiated many times.

SUBSCRIBE : devices/<clientId>/messages/devicebound/#

  • Agents should subscribe to a single wild card topic to receive all messages published to them.

Create own Asset model

This operation creates own asset model by describing aspect types, asset types, asset instances and data point mappings.

Asset Model message:

    {
        "id": "72609761sdv245248e126814c2dd83a27f",
        "data": {
            "externalId": "SpaceShip",
            "typeModel": {
                "aspectTypes": [{
                    "id": "connint6.wing",
                    "name": "${aspectTypeName}",
                    "category": "static",
                    "scope": "private",
                    "variables": [{
                        "name": "temperature",
                        "dataType": "STRING",
                        "unit": "C/F",
                        "searchable": true,
                        "length": 5,
                        "qualityCode": true
                    }],
                    "description": "wing aspect type description",
                    "referenceId": "287adc1a086840e0a6721dfd1170e97c"
                }],
                "assetTypes": [{
                    "id": "connint6.spaceship",
                    "name": "wingAssetTypeName",
                    "parentTypeId": "core.basicasset",
                    "aspects": [{
                        "name": "wingAspect",
                        "aspectTypeId": "connint6.wing"
                    }],
                    "description": "Hyperspace jump capable space ship",
                    "instantiable": true,
                    "scope": "private",
                    "referenceId": "82a4cc2a69cc42af80c1c6cf5dbefde5"
                }]
            },
            "instanceModel": {
                "assets": [{
                    "referenceId": "wingAssetReference",
                    "parentReferenceId": "root",
                    "typeId": "connint6.spaceship",
                    "name": "wingAsset",
                    "description": "The ship of Han Solo and Chewbacca"
                }]
            },
            "mappingModel": {
                "mappings": [{
                    "dataPointId": "dp01",
                    "assetReferenceId": "wingAssetReference",
                    "aspectName": "wingAspect",
                    "variableName": "temperature",
                    "referenceId": "19e9048e78f540e7a9ba25e1249fea9b"
                }]
            }
        }
    }

Receive Model Creation Status

This operation can be used to receive model creation status for previous model request.

    {
        "id": "01FQC37FCCASSFT7M0D6W5EB8P",
        "correlationId": "01FQC37FCBG1DWMTEC4DYCZ327",
        "requestId": "72609761sdv245248e126814c2dd83a27f",
        "data": {
            "id": "01FQC37HX2KGP4DR0HNVR3K5B2",
            "externalId": "SpaceShip",
            "status": "Success"
        }
    }

Create Model Instantiations

This operation creates a new instance with a given asset model in the body.

Instanitate model message:

    {
        "id": "bb9b9d8d6193ddsss45a5w2s7e848fe28c",
        "data": {
            "modelExternalId": "SpaceShip",
            "parameterization": {
                "values": [{
                    "name": "aspectTypeName",
                    "value": "wingAspectTypeName"
                }]
            }
        }
    }

Receive Instantiation Job results

This operation can be used to receive instantiation job results for previous instantiation request.

Instantiation Job result message:

Message 1;

    {
        "id": "01FQC37RDJ54CAM75RWNAQV781",
        "correlationId": "01FQC37NKDHM4774NB1R1H7PST",
        "data": {
            "id": "01FQC37NVVFZWET43NSHYZJV4B",
            "modelId": "01FQC37HX2KGP4DR0HNVR3K5B2",
            "modelExternalId": "SpaceShip",
            "message": "25% completed.",
            "status": "InProgress"
        },
        "requestId": "bb9b9d8d6193ddsss45a5w2s7e848fe28c"
    }

Message 2;

    {
        "id": "01FQC37RDJ54CAM75RWNAQV781",
        "correlationId": "01FQC37NKDHM4774NB1R1H7PST",
        "data": {
            "id": "01FQC37NVVFZWET43NSHYZJV4B",
            "modelId": "01FQC37HX2KGP4DR0HNVR3K5B2",
            "modelExternalId": "SpaceShip",
            "message": "50% completed.",
            "status": "InProgress"
        },
        "requestId": "bb9b9d8d6193ddsss45a5w2s7e848fe28c"
    }

Message 1;

    {
        "id": "01FQC37RDJ54CAM75RWNAQV781",
        "correlationId": "01FQC37NKDHM4774NB1R1H7PST",
        "data": {
            "id": "01FQC37NVVFZWET43NSHYZJV4B",
            "modelId": "01FQC37HX2KGP4DR0HNVR3K5B2",
            "modelExternalId": "SpaceShip",
            "message": "75% completed.",
            "status": "InProgress"
        },
        "requestId": "bb9b9d8d6193ddsss45a5w2s7e848fe28c"
    }

Message 4;

    {
        "id": "01FQC37RDJ54CAM75RWNAQV781",
        "correlationId": "01FQC37NKDHM4774NB1R1H7PST",
        "data": {
            "id": "01FQC37NVVFZWET43NSHYZJV4B",
            "modelId": "01FQC37HX2KGP4DR0HNVR3K5B2",
            "modelExternalId": "SpaceShip",
            "message": "100% completed.",
            "status": "Success"
        },
        "requestId": "bb9b9d8d6193ddsss45a5w2s7e848fe28c"
    }

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.


Last update: January 11, 2022