Upload
claudio-akira-endo
View
160
Download
4
Embed Size (px)
Citation preview
1
Case REST API Hands on LabIn this lab, we will explore the Case REST APIs. We will use an existing solution such as Auto Claims HOL. You will use the Firefox Poster add-on to send the REST requests to the server.
Details on the Case REST API resources can be found at: http://publib.boulder.ibm.com/infocenter/casemgmt/v5r1m0/index.jsp?topic=/com.ibm.casemgmt.installing.doc/acmdv014.htm
Lab 1: Get a list of deployed solutions
Get a list of deployed solutions from IBM Case Manager. We will use the Firefox Poster plugin. Type the following in the URL field:
URL:http://ecmdemo1:9080/CaseManager/CASEREST/v1/solutions
Operation: GET
On the image, launch Firefox. Poster can be found under Tools → Poster. Fill in the URL to Poster as follows, and set the Content Type to application/json:
Click on Get. Poster will send the Http Request and the response will be presented in
Case REST API Hands on Lab
2
a new dialog
To do a pretty view of the JSON that was returned, copy the JSON response to the Text tab of JSON Viewer (launch JSONView from the desktop shortcut) . The formatted JSON can be viewed in the Viewer tab.
Lab 2: Get a list of case types for a deployed solution
Case REST API Hands on Lab
3
You will need to provide the solution name from the JSON response from the previous request. The solution name used below is Auto Claims HOL.
URL:http://ecmdemo1:9080/CaseManager/CASEREST/v1/solution/Auto Claims HOL/casetypes?TargetObjectStore=CMTOS
Operation: GET
{"CaseTypes":[{"CaseType":"AC_GeneralClaim","DisplayName":"General Claim", "Description":"","HasInstanceCreationRights":true,"HasAnnotationRights":true}]}
Lab 3: Get the view definitions for the case type for a deployed solution
The URL here includes the case type found by the previous request.
URL:http://ecmdemo1:9080/CaseManager/CASEREST/v1/casetype/AC_GeneralClaim/viewdefinitions?TargetObjectStore=CMTOS
Operation: GET
JSON Response:{"CaseTitleProperty":"CmAcmCaseIdentifier","CaseSummaryView":{"Fields":[{"FieldType":"property","Name":"AC_PolicyNumber"},{"FieldType":"property","Name":"AC_DateReceived"}]},"CaseDataView":{"Fields":[{"Label":"Policy Details","FieldType":"group","OpenState":true,"Fields":[{"FieldType":"property","Name":"AC_CustomerName"},{"FieldType":"property","Name":"AC_PolicyNumber"}]},{"Label":"Claim Details","FieldType":"group","OpenState":false,"Fields":[{"FieldType":"property","Name":"AC_DateReceived"},{"FieldType":"property","Name":"AC_DueDate"}]}]}}
Case REST API Hands on Lab
4
Lab 4: Get a list of ad hoc task types
For this lab, we will use the Credit Card Dispute Management solution as we do not have any ad hoc tasks created for the Auto Claims HOL solution. (In Case Builder, these ad hoc tasks are known as “User-created tasks”).
URL:http://ecmdemo1:9080/CaseManager/CASEREST/v1/casetype/CCDM_ManageDisputeItem/discretionarytasktypes?TargetObjectStore=CMTOS
Operation: GET
JSON Response:{"DiscretionaryTaskTypes":[{"TaskName":"CCDM_RequestSalesCopy","HasInstanceCreationRights":true,"TaskDisplayName":"Request Sales Copy","Description":"Allows CSR or DA to request a sales copy to add to the case.","TaskClassId":"{9DEF4E6D-A863-4F3F-91DD-5D50ED13AF34}","RequiresLaunchInfo":true},{"TaskName":"CCDM_RequestLetter","HasInstanceCreationRights":true,"TaskDisplayName":"Request Letter","Description":"Request Letter","TaskClassId":"{DEFB9C48-7FFD-4738-B77C-09F5D36B6F97}","RequiresLaunchInfo":true},{"TaskName":"CCDM_ReviewCase","HasInstanceCreationRights":true,"TaskDisplayName":"Review Case","Description":"Review Case","TaskClassId":"{55C82645-B968-4975-807A-F84F1DB39B71}","RequiresLaunchInfo":true}]}
Case REST API Hands on Lab
5
Lab 5: Get a list of task instances for a given case
URL:http://ecmdemo1:9080/CaseManager/CASEREST/v1/case/35F20F76-150D-4F3B-9101-FFD03FD29F7E/tasks?TargetObjectStore=CMTOS&Grouping=ROD
To find the case GUID to use in the above URL, use FileNet Enterprise Manager. Within the CMTOS object store's Root Folder, find the case folder in the Cases hierarchy (e.g., as highlighted below), right click on the case and choose Properties, then use the ID value (without { and }) under All Properties.
The Grouping parameter must be set to ROD and indicates that tasks will be listed in Required, Optional, and Disabled groups.
Case REST API Hands on Lab
6
Operation: GET
JSON Response:{"Optional":[{"TaskId":"{443CEA6C-8488-4F0C-8C75-951B73A4892B}","TaskName":"Add Document","RequiredState":0,"DisabledState":0,"LaunchMode":4,"DateCreated":"2011-12-21T21:04:00Z","TaskState":1,"DateLastModified":"2011-12-21T21:04:00Z"},…"Required":[{"TaskId":"{D101B22E-0B1C-4DE7-9C7C-0A9B81B2BBBE}","TaskName":"Close Case","RequiredState":1,"DisabledState":0,"LaunchMode":1,"DateCreated":"2011-12-21T21:04:00Z","TaskState":1,"DateLastModified":"2011-12-21T21:04:00Z"},...
Case REST API Hands on Lab
7
Lab 6: Get a list of comments for a case
Each comment for a case is of one of the following “types” (i.e., it is affiliated with an object of that type in the case): Case, Task, Document, WorkItem. When getting the comments of type Case, the GUID in the URL specifies the case. When getting other types of comments, you must provide an ItemId parameter that identifies the object whose comments you want returned.
URL:
This is the same URL as in the previous Lab, except with “/tasks” changed to “/comments”, and “&Grouping=ROD” changed to “&CommentType=Case” at the end.
http://ecmdemo1:9080/CaseManager/CASEREST/v1/case/35F20F76-150D-4F3B-9101-FFD03FD29F7E/comments?TargetObjectStore=CMTOS&CommentType=Case
Operation: GET
JSON Response:
If the case you chose doesn't have any comments, you will be able to try this request again after the following lab, or you can use the Case Client to add a comment (it must have the Case type) and try again now.
Case REST API Hands on Lab
8
Lab 7: Add a comment to a case
URL:
Use the same URL as for the previous lab, except that you need to remove “&CommentType=Case” from the end.
http://ecmdemo1:9080/CaseManager/CASEREST/v1/case/35F20F76-150D-4F3B-9101-FFD03FD29F7E/comments?TargetObjectStore=CMTOS
Operation: POST
JSON Data for POST – Copy the following JSON, including the curly braces, into the “Content to Send” tab area.{ "CommentType":"case", "CommentContext": 102, "CommentText": "Comment added in Lab 7"}
You should receive a Status of 201 Created.
Lab 8: Verify added comment
Repeat step 6 and see if the comments list now returns the recently added comment.
You can also verify this on the Case Details page in the Case Client.
Lab 9: Get case type properties
In this lab you will get the properties for a case type (General Claim in the Auto Claims HOL solution), which we will then use in creating a case of that type.
URL:
http://ecmdemo1:9080/CaseManager/CASEREST/v1/casetype/AC_GeneralClaim?TargetObjectStore=CMTOS
Operation: GET
You should receive a Status of 200 OK, and a lengthy JSON response that includes the details on the 25 or so properties for the case type. You can view the response in JSON Viewer if interested.
Case REST API Hands on Lab
9
Lab 10: Create a case
In this lab you will create a case of type General Claim (in the Auto Claims HOL solution). Unlike most other Case REST API resources, “cases” has a very simple URL, while the payload is used to provide the details, including the case type (and solution, through the case type prefix), the target object store name, and the property values. We are only specifying values for a few of the properties listed by Lab 9.
URL:
http://ecmdemo1:9080/CaseManager/CASEREST/v1/cases
Operation: POST
JSON Data for POST – Copy the following JSON, including the curly braces, into the “Content to Send” tab area.
{ "CaseType": "AC_GeneralClaim", "TargetObjectStore": "CMTOS", "ReturnUpdates": false, "Properties" : [ { "SymbolicName": "AC_CustomerName", "Value" : "API New Case Customer" }, { "SymbolicName": "AC_PolicyNumber", "Value" : "PN_123456" }, { "SymbolicName": "AC_DateReceived", "Value" : "2011-10-31T18:50:36Z" } ]}
You should receive a Status of 201 Created.
Keep the Case Folder GUID from the response (as below) for use in the next lab.
{"CaseTitle":"AC_GeneralClaim_000000100101","CaseIdentifier":"AC_GeneralClaim_000000100101","CaseFolderId":"{6707571E-890C-4D94-9211-3B7762894CCF}"}
Case REST API Hands on Lab
10
Lab 11: Split a case
In this lab you will split the case of type General Claim (in the Auto Claims HOL solution) that you created in Lab 10.
URL:
In the following URL, replace the case folder GUID in bold with the GUID from Lab 10, representing the case to be split.
http://ecmdemo1:9080/CaseManager/CASEREST/v1/case/6707571E-890C-4D94-9211-3B7762894CCF
Operation: POST
JSON Data for POST – Copy the following JSON, including the curly braces, into the “Content to Send” tab area.
{ "CaseType": "AC_GeneralClaim", "TargetObjectStore": "CMTOS", "OperationDescription": "Splitting case in workshop", "Operation": "split", "Properties" : [ // here we are setting just two case property values, and not copying documents { "SymbolicName": "AC_CustomerName", "Value" : "API New Case Customer - Split" }, { "SymbolicName": "AC_PolicyNumber", "Value" : "PN_123456_A" } ]}
You should receive a Status of 201 Created.
The response should be the same as in Lab 10, but with a different Case ID and Case Folder ID.
Only the properties and documents specified in the payload are copied to the new case. We have followed the normal path of issuing a GET to retrieve current case data, then passing that array (possibly, as here, with changes and/or deletions) to the POST to split the case.
Case REST API Hands on Lab