Import a Decision Model Snapshot

put

/ic/api/process/v1/dmn/spaces/{spaceId}/decision-models/{decisionModelName}/versions/{decisionModelVersion}

Imports a snapshot into a decision model.

Prerequisites:

  • The target space must already exist in DMN as well as in Composer. Make sure you create the target space using Composer and create at least one decision model in the target space.
  • Before importing a snapshot, create an the empty target decision model by making a PUT request on the decision model resource. See Create an Empty Decision Model for details.

To successfully import a decision model snapshot, the following conditions must be met:

  • The request body must contain the JSON representation of the snapshot to be imported.
  • The path parameter decisionModelVersion must be set to the name of the snapshot created during the import. If this is the first import to an empty decision model, you must set the snapshot name to LATEST.
  • The name attribute of the decision model version in the request body must have the same value as the path parameter decisionModelVersion. For example, set to LATEST as in the example below.
  • The authorization header must be set to type Bearer and an access token must be provided.

Example:

{
  "@class": ".DecisionModelVersion",
  "name": "LATEST",
  "description": "Initial version"
  ...
  

}

Request

Supported Media Types
Path Parameters
Header Parameters
  • Authorization header MUST be set to type Bearer and an access token must be provided i.e. 'Bearer '
    Default Value: Bearer XXXXX.XXXXX.XXXXX
Body ()
JSON representation of the decision model snapshot
Root Schema : DecisionModelVersion
Match All
Show Source
Nested Schema : RestObject
Type: object
Show Source
Nested Schema : DecisionModelVersion-allOf[1]
Type: object
Show Source
Nested Schema : Definition
Match All
Show Source
Nested Schema : RestCollection
Match All
Show Source
Nested Schema : Definition-allOf[1]
Type: object
Show Source
Nested Schema : RestCollection-allOf[1]
Type: object
Show Source
Nested Schema : items
Type: array
Show Source
Back to Top

Response

Supported Media Types

204 Response

No Content (Operation successful)

400 Response

Bad Request

401 Response

Unauthorized

403 Response

Forbidden (Expired or invalid token)

500 Response

Internal Server Error
Back to Top

Examples

The following examples show you the sequence of steps to take to import a decision model to another environment and activate it with a version.

Step 1: Create an Empty Decision Model without a Snapshot

To create an empty decision model named mydecisionmodel without a snapshot, use the API Create an Empty Decision Model.

Send Request:

PUT /ic/api/process/v1/dmn/spaces/{spaceId}/decision-models/mydecisionmodel

Request Body:

{
  "@class": ".DecisionModel",
  "name": "mydecisionmodel",
  "description": "Any text description",
  "versions": {
    "@class": ".RestCollection",
    "name": "versions",
    "items": []
  },
  "tags": {
    "@class": ".RestCollection",
    "name": "tags",
    "items": []
  },
  "permissions": {
    "@class": ".RestCollection",
    "name": "permissions",
    "items": []
  }
}

Step 2: Import the LATEST Decision Model Snapshot for mydecisionmodel

The first import to an empty decision model must always have the snapshot name LATEST. Modify your decision model snapshot and give it the name LATEST, then import the JSON you modified to create the LATEST snapshot.

Send Request:

PUT /ic/api/process/v1/dmn/spaces/{spaceId}/decision-models/mydecisionmodel/versions/LATEST 

Request Body:

For example, mysnapshot.dmn:

{
@class": ".DecisionModelVersion",
"name": "LATEST",
"description": "Initial version"
...
}

Step 3: Import the 1.0 Decision Model Snapshot for mydecisionmodel

Modify the LATEST decision model JSON you just imported, give it the name 1.0, then import the JSON you modified to create the 1.0 snapshot.

Send Request:

PUT /ic/api/process/v1/dmn/spaces/{spaceId}/decision-models/mydecisionmodel/versions/1.0 

Request Body:

For example, mysnapshot.dmn:

{
"@class": ".DecisionModelVersion",
"name": "1.0",
"description": "First snapshot version"
 
...
}

Step 4: Deploy the 1.0 Decision Model Snapshot

Use the API Deploy a Decision Model Snapshot to deploy the 1.0 decision model snapshot.

The request body must contain the JSON representation to associate the imported snapshot version with the tagId version.

Format:

{
"@class":".DecisionModelTag",  "name":"<tagId>", 
"ref":
{ "@class":".DecisionModelTag$VersionReference", "name":"<snapshotId>" } 

} 

Send Request:

The authorization header must be set to type Bearer and an access token must be provided.

PUT /ic/api/process/v1/dmn/spaces/{spaceId}/decisionmodels/mydecisionmodel/tags/1.0 

Request Body:


{
"@class":".DecisionModelTag", "name":"1.0",
"ref":
{ "@class":".DecisionModelTag$VersionReference", "name":"1.0" }
 
}

Example: Redeploy snapshot 1.0 with tagId 2.0

The following PUT request will deploy snapshot version 2.0 as runtime version 1.0. This allows the DMN client which has been invoking runtime version 1.0 to uptake the changes in snapshot 2.0 without having to modify its invoke call.

Send Request:

PUT /ic/api/process/v1/dmn/spaces/{spaceId}/decision-models/mydecisionmodel/tags/1.0 
Request Body:
{ 
"@class":".DecisionModelTag",  "name":"2.0", 
"ref":
{ "@class":".DecisionModelTag$VersionReference", "name":"1.0" } 

} 

Example: Import a new 2.0 snapshot and deploy it with tagId 2.0

Import a new 2.0 snapshot

Send Request:

PUT /ic/api/process/v1/dmn/spaces/{spaceId}/decision-models/mydecisionmodel/versions/2.0 

Request Body:

For example, mysnapshot2.0.dmn:

{
@class": ".DecisionModelVersion",
"name": "2.0",
"description": "First snapshot version"
...
}

Deploy the new 2.0 snapshot

Send Request:

PUT /ic/api/process/v1/dmn/spaces/{spaceId}/decisionmodels/mydecisionmodel/tags/2.0 

Request Body:


{
"@class":".DecisionModelTag", "name":"2.0",
"ref":
{ "@class":".DecisionModelTag$VersionReference", "name":"2.0" }
 
}
Back to Top