Defining the instance migration policy by using a REST API
When you migrate from one version to another, you can use IBM Business Automation Studio to define an instance migration policy for deleting or moving orphaned tokens. Otherwise, you can use a REST API call to create the migration policy. An orphaned token is a token that is associated with an activity that exists in the source version but not in the destination version.
About this task
POST
https://host:port/root/ops/std/bpm/containers/container/migration_policies?sourceContainerSnapshotAcronyms=source_acronyms&targetContainerSnapshotAcronym=target_acronym.
root is the context root for the server. In Business Automation Workflow, the root is bas.
container is the acronym of the project that contains the version you want to
migrate from. source_acronyms is a comma-separated list of source version
acronyms. target_acronym is the acronym of the version that is the target of the
migration. - Encode the commas in the
sourceContainerSnapshotAcronymsquery parameter with%2C
. - BPMCSRFToken is required for this REST API. For more information, see Preventing cross site request
forgery
.
The following examples illustrate how to use the REST API to create a migration policy:
-
- Create a migration policy for migrating from version
V01to targetV03of the workflow automationWF1:POST http://host:port/root/ops/std/bpm/containers/WF1/migration_policies?sourceContainerSnapshotAcronyms=V01&targetContainerSnapshotAcronym=V03 - Create a migration policy for migrating from versions
V01andV02to targetV03of the workflow automationWF1:POST http://host:port/root/ops/std/bpm/containers/WF1/migration_policies?sourceContainerSnapshotAcronyms=V01%2CV02&targetContainerSnapshotAcronym=V03
- Create a migration policy for migrating from version
After you download the created policy file, you can then call
operations REST API GET
https://host:port/root/ops/std/bpm/containers/container/versions/target_acronym/migration_policies/migration_policy_id/export?source_version=source_acronym.
root is the context root for the server. In Business Automation Workflow, the root is bas.
container is the acronym of the project that contains version you want to migrate
from. target_acronym is the acronym of the version which is the target of the
migration. source_acronym is the source version acronym.
migration_policy_id is the migration_policy_Id field
returned from the previous POST REST API response.
The following example illustrates how to use the REST API to export your newly created migration policy file.
- Export your created migration policy file for migrating from version
V01to target versionV03of the workflow automationWF1where 2125.bdd71957-1a38-41f9-b425-44df022f9ea8 is the migration_policy_Id returned from the previous POST REST API:GET http://host:port/root/ops/std/bpm/containers/WF1/versions/V03/migration_policies/2125.bdd71957-1a38-41f9-b425-44df022f9ea8/export?source_version=V01
Procedure
Results
<?xml version="1.0" encoding="UTF-8"?>
<orphanTokenPolicy>
<processApplication acronym="HSS" id="2066.9ab0d0c6-d92c-4355-9ed5-d8a05acdc4b0" name="Hiring Sample">
<sourceSnapshot acronym="RHS8570" id="2064.f1659d94-2365-4903-8a90-9fa62f3ccd31" name="Responsive Hiring Sample v8570_01"/>
<targetSnapshot acronym="OTT" id="2064.b15dcea3-1e3f-4721-9a6c-b3f23046f68c" name="Ophaned Token Test"/>
<process bpdId="25.c904b3b1-afc1-4698-bf5a-a20892c20275" name="Standard HR Open New Position">
<step id="bpdid:431b0753c33842e2:3d5457c0:141a2fd3448:-75fb" name="Submit position request">
<move name="User Task" suspendProcess="true" targetStepId="e78fd2f7-c441-4011-8a42-ae339bf3f581"/>
</step>
<step id="bpdid:431b0753c33842e2:3d5457c0:141a2fd3448:-7576" name="Send escalation notice">
<delete suspendProcess="false"/>
</step>
</process>
</processApplication>
</orphanTokenPolicy>
What to do next
You can now use the policy file during instance migration, as discussed in Defining the instance migration policy.