IBM Support

Examples of interacting with Case Manager using REST API and CMIS

Technical Blog Post


Abstract

Examples of interacting with Case Manager using REST API and CMIS

Body

Recently I worked on a demonstration that integrates IBM Case Manager with IBM Watson Explorer. It became clear to me that the REST API offers an easy approach for the integration. However during the cause of building this demonstration, I found that there are not very many examples out there for using the Case REST API and CMIS API with Case Manager, so I thought I would share a few simple examples here with you.

The Case REST API is pretty easy to use and lets you create new cases and get information about specific case objects. However if you want to do things like querying about cases in general or anything to do with folders or documents, then you will need to use the CMIS API.

The following are some simple examples. For this article I am using cURL in a Windows command to demonstrate the usage. To try them out, you have to setup cURL, and then type the commands into the command line.

https://curl.haxx.se/

 

An example of creating a case:

The data fields are stored in a separate file to avoid issues with quotes and so on.

> curl -X POST -u user:password http://caseserver:port/CaseManager/CASEREST/v1/cases -H "Content-type:application/json" -d @example1.txt

where example1.txt is:

{TargetObjectStore: 'CMTOS',

CaseType: 'XY_CaseType',

Properties: [

{SymbolicName:'XY_CustomerName', Value: 'John Smith'},

{SymbolicName:'XY_AccountNumber',Value: '12345678'}

]}

 

An example of updating the properties of a specific case:

In this case, you must use the specific the GUID of the case, which in this example is ‘F1C1EEB9-AC69-C853-87A9-5BF26D900000’.

> curl -u user:password -X PUT http:// server:port/CaseManager/CASEREST/v1/case/F1C1EEB9-AC69-C853-87A9-5BF26D900000?TargetObjectStore=CMTOS -d @example2.txt

where example2.txt is:

{ TargetObjectStore: 'CMTOS',

  CaseType: 'XY_CaseType',

  ReturnUpdates: true,

  Properties:  [

  {SymbolicName: 'XY_Address', Value: 'Green Road'},

  {SymbolicName: 'XY_Email', Value: 'guy@greatmail.com'}

  ]}

 

An example of a query to find all the cases based on a case type:

> curl -u user:password -X GET http:// server:port/openfncmis/atom11/CMTOS/query?q=SELECT%20name%20FROM%20cmis%3Afolder%20WHERE%20cmis%3AobjectTypeId=’XY_CaseType'

This works because the Case Manager models a case container using a folder object.

 

Lastly an example of adding a document to a specific case:

Again you must use the specific the GUID of the case, which in this example is ‘F1C1EEB9-AC69-C853-87A9-5BF26D900000’.

> curl -u user:password -X POST http:// server:port/openfncmis/atom11/CMTOS/children?id=F1C1EEB9-AC69-C853-87A9-5BF26D900000^&ContentType=application/xml -d @example3.txt

 

where example3.txt is:

 

<?xml version='1.0' encoding='UTF-8'?>

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom&quot; xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/&quot;

 

xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/&quot; xmlns:app="http://www.w3.org/2007/app"&gt;

<atom:title>TestFile.txt</atom:title>

    <atom:content>

      Hello World!

    </atom:content>

  <cmisra:object>

    <cmis:properties>

      <cmis:propertyString propertyDefinitionId="cmis:name" displayName="Name" localName="Name" queryName="cmis:name">

         <cmis:value>TestFile.txt</cmis:value>

      </cmis:propertyString>

      <cmis:propertyString propertyDefinitionId="DocumentTitle" displayName="Document Title"

localName="DocumentTitle" queryName="DocumentTitle">

        <cmis:value>TestFile.txt</cmis:value>

 

      </cmis:propertyString>

      <cmis:propertyId propertyDefinitionId="cmis:objectTypeId" displayName="cmis:objectTypeId" localName=""

queryName="cmis:objectTypeId">

        <cmis:value>cmis:document</cmis:value>

      </cmis:propertyId>

    </cmis:properties>

  </cmisra:object>

</atom:entry>

 

I hope this is helpful for you.

Documentation about Case REST API:

https://www.ibm.com/support/knowledgecenter/SSCTJ4_5.3.0/com.ibm.casemgmt.development.doc/acmdv133.htm

Using CMIS for FileNet to interaction with Case Manager objects:

https://www.ibm.com/support/knowledgecenter/SSCTJ4_5.3.0/com.ibm.casemgmt.development.doc/acmdv020.htm

 

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCTJ4","label":"IBM Case Manager"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

UID

ibm11280842