# Models v2

This API allows you to manage the object models for a specific module.

# PUB Create an object model

# from/module/{module_id}/action/model/create

Create or update an object model (that is, a requested model) in IM using the model.create action message sent to the platform.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

Message format

Properties:

Key Value Notes Mandatory
correlationId <string> Unique String (e.g. uuid) No
ack <string> and value in ("positive", "negative", "all", "none") No
target <string> No
context <string> No
timestamp <string> Date time in ISO-8601 format No

These properties can be included in the request by adding them to the topic to which you are sending the messages. See the Message Properties section to find out more.

Here is an example of the properties used:

from/module/{module_id}/action/model/create&objectId={objectId}&ack=all

Payload information:

Key Value Notes Mandatory
objectId <string> Format: uuid Yes
model <string> Yes
type <string> Yes
name <string> No
properties <object> No
variables <object> No

Here is an example payload:

{
  "model": "abb.ability.device",
  "type": "abb.ability.device.edge.modules.sample@1",
  "name": "device1",
  "properties": {
    "name": {
      "value": "3dcfba97-faa3-4934-a53e-9be23a4aba2f/blmodule"
    }
  },
  "objectId": "01bb4222-551d-416e-bb38-00ac0d4c96ea"
}

# SUB Notification for model creation

If the object model did not exist prior to this request, DCS will return Abb.Ability.InformationModel.ObjectModelCreated notification to the device when the model.create action is fired. If the object model already existed at the time of firing model.create, then DCS will return Abb.Ability.InformationModel.ObjectModelUpdated notification to the device. The model details received would be published to the below topic.

# to/module/{module_id}/event/model/{model_id}/{object_id}

Parameters:

Key Value Mandatory Description
module_id <string> Yes Module identifier
model_id <string> Yes Model definition identifier
object_id <string> Yes Object identifier

Message format

Properties:

Key Value Notes Mandatory
timestamp <string> Date time in ISO-8601 format No
correlationId <string> Unique String (e.g. uuid) No
target <string> No
context <string> No

Payload information:

The payload should contain a full object model sent to the topic as is.

Here is a payload example:

{
  "objectId": "bb495bb9-047a-4fe1-9881-0e3aa3668787",
  "model": "abb.ability.device",
  "type": "abb.ability.edge@1",
  "name": "string",
  "properties": {},
  "variables": {}
}

# SUB Ack for model creation

# to/module/{module_id}/ack/model/create

Use this endpoint to check whether the object model was created successfully.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

# PUB Update an object model

# from/module/{module_id}/action/model/update

Use this endpoint to update an object model.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

Message format

Properties:

Key Value Notes Mandatory
correlationId <string> Unique String (e.g. uuid) No
ack <string> And value in ("positive", "negative", "all", "none") No
target <string> No
context <string> No
timestamp <string> Date time in ISO-8601 format No
objectId <string> Format: uuid Yes
model <string> Yes

These properties can be included in the request by adding them to the topic you are sending the messages to. See the Message Properties section to find out more.

Here is an example of the properties used:

from/module/{module_id}/action/model/update&objectId={objectId}&model={modelId}&ack=all

Payload information:

Key Value Notes Mandatory
objectId <string> Format: uuid Yes
model <string> Yes
type <string> Yes
name <string> No
properties <object> No
variables <object> No
version <string> Yes

Here is an example payload:

{
        "objectId": "0d7a78c3-6aa1-4325-b30b-e99534868e38",
        "model": "abb.ability.device",
        "type": "abb.ability.device.edge.modules.sample@1",
        "name": "blmodule1",
        "properties": {
          "name": {
            "value": "05424aa0-0b01-4374-826b-4576668efc55/blmodule1"
          },
          "test": {
            "value": "udpate3"
          }
        },
        "version": 3
      }

# SUB Ack for model update

# to/module/{module_id}/ack/model/update

Use this endpoint to check whether the object model update was successful.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

# PUB Patch an object model

# from/module/{module_id}/action/model/patch

Use this endpoint to patch an object model.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

Message format

Properties:

Key Value Notes Mandatory
correlationId <string> Unique String (e.g. uuid) No
ack <string> And value in ("positive", "negative", "all", "none") No
target <string> No
context <string> No
timestamp <string> Date time in ISO-8601 format No
objectId <string> Format: uuid Yes
model <string> Yes

These properties can be included in the request by adding them to the topic you are sending the messages to. See the Message Properties section to find out more.

Here is an example of the properties used:

from/module/{module_id}/action/model/patch&objectId={objectId}&model={modelId}&ack=all

Payload information:

The payload should contain a well-formed JSON body.

Here is an example of a payload:

{
        "objectId": "0d7a78c3-6aa1-4325-b30b-e99534868e38",
        "model": "abb.ability.device",
         "test": { "value": "udpate3" },
        "version": 3
}

# SUB Ack for model patch

# to/module/{module_id}/ack/model/patch\

Use this endpoint to check whether the object model was patched successfully.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

# PUB Delete an object model

# from/module/{module_id}/action/model/delete

Use this endpoint to delete an object model.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

Message format

Properties:

Key Value Notes Mandatory
correlationId <string> Unique String (ex: uuid) No
ack <string> And value in ("positive", "negative", "all", "none") No
target" <string> No
context <string> No
timestamp <string> Date time in ISO-8601 format No
objectId <string> Format: uuid Yes
model <string> Yes

These properties can be included in the request by adding them to the topic you are sending the messages to. See the Message Properties section to find out more.

Here is an example of the properties used:

from/module/{module_id}/action/model/delete&objectId={objectId}&model={modelId}&ack=all

Payload information:

{ }

# SUB Ack for model deletion

# to/module/{module_id}/ack/model/delete

Use this endpoint to check whether the object model was deleted successfully.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

# PUB Query a model

# from/module/{module_id}/action/model/query

Use this endpoint to query the latest version of models and references.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module

Message format

Properties:

Key Value Notes Mandatory
correlationId <string> Unique String (ex: uuid) No
ack <string> No
target <string> No
context <string> No
retain <boolean> No

These properties can be included in the request by adding them to the topic you are sending the messages to. See the Message Properties section to find out more.

Here is an example of the properties used:

from/module/{module_id}/action/model/query&ack=all

Payload information:

{
  "query": "<DSL query string>"
}

Here are a few payload examples:


 {
	"query": "models('abb.ability.device').hasObjectId('{object id}')"
 }
 {
 	"query": "models('abb.ability.configuration').hasObjectId('{object id of corresponding edge, module, etc}')"
}
{
	"query": "models('abb.ability.device', 'abb.ability.configuration').hasObjectId(within('05424aa0-0b01-4374-826b-4576668efc55'))"
}
{
 	"query": "models('abb.ability.device').ownedBy('8a4993d7-997d-4e54-8083-098c3062c0bb', eq('')).outReference('modules').union(toModel(), toModel().otherModels('abb.ability.configuration'))"
}
{
	"query": "models('abb.ability.device').ownedBy('{owner id}')"
}
{
	"query": "models('abb.ability.device').ownedBy('d10a51bc-7ac5-4d41-9c0f-33a6bb4815bf').outReference('modules','devices')"
}

# SUB Notification for query model

If the object model did not exist prior to this request, DCS returns a Abb.Ability.InformationModel.ObjectModelCreated notification to the device when the model.create action is fired. If the object model already existed at the time of firing model.create then DCS returns Abb.Ability.InformationModel.ObjectModelUpdated notification to the device. The model details received would be published to the topic below:

# to/module/{module_id}/event/model/{model_id}/{object_id}

Parameters:

Key Value Mandatory Description
module_id <string> Yes Module identifier
model_id <string> Yes Model definition identifier
object_id <string> Yes Object identifier

Message format

Properties:

Key Value Notes Mandatory
timestamp <string> Date time in ISO-8601 format No
correlationId <string> Unique String (e.g. uuid) No
target <string> No
context <string> No

Payload information:

The payload should contain a full object model sent to the topic as is.

Here is an example payload:

{
  "objectId": "bb495bb9-047a-4fe1-9881-0e3aa3668787",
  "model": "abb.ability.device",
  "type": "abb.ability.edge@1",
  "name": "string",
  "properties": {},
  "variables": {}
}

# SUB Ack for model query

# to/module/{module_id}/ack/model/query

Use this endpoint to check whether the model query was successful.

Parameters:

Name Type Description Accepted values
module_id string Module identifier Name of module
Last updated: 1/10/2022, 11:05:26 AM
Feedback