question

Upvotes
Accepted
5 6 3 8

Get a case result using case system ID returns empty JSON array

Hi Team,

I have developed an interface in C# to call the API. After creating and screening a case, I sometimes get an empty JSON array when I try to get the case results. For the same case, if I try again, I sometimes get the result I want.

Can you please advice ?

Thanks.

world-checkworld-check-one
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
4.2k 8 5 6

Hello @cliff.ching ,

Kindly note the API call to screen the case is an asynchronous request, hence as soon as the API is called, WC1 API places the request in the queue and screens the case according to the available capacity of the system. In short, the screening of the case is not instantaneous.

Most likely you are calling the API "Get case results" before the case has been screened completely so you get an empty response. I advise you to call another API "SEQ-8: Retrieve the audit log for a case" to find out whether the case has been screened or not.

An excerpt of the response body of the API "Retrieve the audit log for a case" is given below.

{
"id": "0a3687cf-61fc-110b-9893-47000c2402",
"objectId": "0a3687d0-61fc-1a893-46a00002148d",
"eventDate": "2018-03-22T09:50:42.377Z",
"actionedByUserId": "0a387cf-611f-1466-5974000011c2",
"actionedByUserName": "Irfan Khan",
"note": null,
"entityType": "CASE",
"actionType": "SCREENED_CASE",
"auditEventToDate": null,
"details": {
"detailsType": "ScreenCaseAuditDetails",
"userId": null,
"statusCode": "COMPLETED",
"screeningState": "INITIAL",
"noOfNewResults": 4,
"noOfReviewRequiredResults": 0,
"noOfExcludedResults": 0,
"noOfAutoResolvedResults": 0,
"providerTypes": [
"WATCHLIST"
],
"caseScreenRequestor": null,
"caseSystemId": "0a3687d0-69893-46a00002148d"
}

You need to check for the key "actionType" and its value as "Screened Case" in the response body to be sure that the case has been screened. If you do not see the value of "actionType" as Screened Case or if the response of the API "Retrieve the audit log for a case" is empty, it means that the case has not been screened yet.

After this check, you can call the API "Get case results" and it will always return the collection of results related to the case.

Kindly let me know if the solution worked for you by accepting the answer.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5 6 3 8

Hi, I am getting a 400 Bad request when calling SEQ 8. Can you look into my request details and advice ? Thanks!

Request End Point: https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/0a3687d0-626d-17eb-98a6-678700092d1e/auditEvents
POST (request-target): post /v1/cases/0a3687d0-626d-17eb-98a6-678700092d1e/auditEvents
host: rms-world-check-one-api-pilot.thomsonreuters.com
date: Fri, 06 Apr 2018 06:21:40 GMT

Signature keyId="0b9f66af-04f0-413f-aae7-b4ea74bf97db",algorithm="hmac-sha256",headers="(request-target) host date",signature="JhBYaQc/fo0PK3KANaGmFPVBl+F0Mm5cyoR3z9i3ysw="

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @cliff.ching ,

What is the request body you are sending for the API "Retrieve Audit logs"? Also, let me know the response body after the error 400 is received.

Can you reproduce this in postman or is it replicable only in your code?

Hi,

Please see below for the request body.

and below for the response

seq-8.jpg (36.7 KiB)
seq-8-3.jpg (45.2 KiB)
Upvotes
4.2k 8 5 6

Hello @cliff.ching ,

What is the request body you are sending for the API "Retrieve Audit logs"? Also, let me know the response body after the error 400 is received.

Can you reproduce this in postman or is it replicable only in your code?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5 6 3 8

Hi Khan,

I replied an hour ago. Kindly take a look.

Thanks

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
4.2k 8 5 6

Hello @cliff.ching ,

I do not see any payload body being sent to the WC1 API for this post request. I only see the authorization headers & date being sent and it does not include the content-length and content-type in it. Please note for this post request, you need to include content length, content and content-type in your datatoSign variable while content-length and content-type should be included in the request headers.

This API call includes the below payload body to filter the cases as per the client's requirement. This should be sent along in the header while calling the API.

{ "query" : "actionType==SCREENED_CASE;actionedByUserId=={ {user-id}};eventDate>2010-01-01T00:00:00Z;eventDate<2020-01-01T00:00:00Z" }

I am amending the request details you provided for your reference:

Request End Point: https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/0a3687d0-626d-17eb-98a6-678700092d1e/auditEvents


POST (request-target): post /v1/cases/0a3687d0-626d-17eb-98a6-678700092d1e/auditEvents
host: rms-world-check-one-api-pilot.thomsonreuters.com
date: Fri, 06 Apr 2018 06:21:40 GMT

content-type: application/json

content-length:

{ {content}}->[This should include the payload you are sending]

Signature keyId="0b9f66af-04f0-413f-aae7-b4ea74bf97db",algorithm="hmac-sha256",headers="(request-target) host date

content-type content-length",signature="JhBYaQc/fo0PK3KANaGmFPVBl+F0Mm5cyoR3z9i3ysw="

Kindly check the API documentation to understand how to call the API "Retrieve audit logs"

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
4.2k 8 5 6

Hello @cliff.ching ,

I am pasting a code snippet in C# which will illustrate the format we are expecting the request to come in to honor it. Kindly note the code displayed is just for reference and to explain how to send requests. We do not recommend its use in your environment.

var client = new RestClient("https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/0a3687d0-626d-17eb-989d-b3370000579a/auditEvents");
var request = new RestRequest(Method.POST);
request.AddHeader("Postman-Token", "4751e89c-3b3c-4e3a-b27a-30ae5f627f51");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Content-Length", "158");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Date", "Fri, 06 Apr 2018 10:15:38 GMT");
request.AddHeader("Authorization", "Signature keyId=\"13f9d-4d73-83e3-9c134663c067\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date content-type content-length\",signature=\"DNFgDbdEcBWdp+WRXjtrnpxFqLJcaOLs=\"");
request.AddParameter("undefined", "{ \"query\" : \"actionType==SCREENED_CASE;actionedByUserId==0a368f-145c-9866-5974000011c2;eventDate>2010-01-01T00:00:00Z;eventDate<2020-01-01T00:00:00Z\" }", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5 6 3 8

Hi Khan,

I am getting the following as a response.

{ 
"query":"actionType==SCREENED_CASE;
actionedByUserId==0a3687d0-611f-16a6-9870-ce4700001793;
eventDate>2010-01-01T00:00:00Z;
eventDate<2020-01-01T00:00:00Z",
"sort":null,
"totalResultCount":0,
"pagination":{"currentPage":1,"itemsPerPage":100,"totalItems":0},
"results":[]
}

Although the above fits the definition of "AuditSearchResponse" mentioned in the documentation, I however found it differ from the expected response you mentioned. For example, I don't find the following

"details": {
  "detailsType": "ScreenCaseAuditDetails",
  "userId": null,
  "statusCode": "COMPLETED",
  "screeningState": "INITIAL",
  "noOfNewResults": 4,
  "noOfReviewRequiredResults": 0,
  "noOfExcludedResults": 0,
  "noOfAutoResolvedResults": 0,

Can you advice which attribute I should use as an indicator for completion?

I sometimes struggle to understand the documentation.

For example, I found the name of the function inconsistent. For instance, the interaction-diagram names function SEQ 8 "Retrieving the audit log for a case" and the schema reference documentation names it "Get a filtered list of AuditEvents for a Case by its caseSystemId".

Also, as the documentation is in "html" format, I found it hard to read some of the text in a image attached in it. Not matter how I enlarge the screen. the image does not enlarge with it. I tried to save the image, yet the resolution of the image is not good enough for me to read the text clearly.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
4.2k 8 5 6

Hello @cliff.ching ,

You should look for the indicator "actionType" and its value as "SCREENED_CASE" to be sure that the case has been screened.

I think the case was not screened that time and hence the API call was unable to pull any data related to SCREENED_CASE for that particular case ID. Generally, if the API is unable to pull any results, it means the case has not been screened yet.

I advise you to remove the filter "actionType==SCREENED_CASE;" and see the response you receive from the API call. Send it over for scrutiny.

Kindly share the case ID so that I can check the case at my end.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@cliff.ching Kindly share the case ID so that I can try and reproduce the issue.

Upvotes
4.2k 8 5 6

Hi @cliff.ching ,

Regarding readability of the sequence diagrams, I have taken this as a feedback and would be forwarding this to my team for their comments.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5 6 3 8

Hi,

I removed the filter

"actionType==SCREENED_CASE;" and I still get something similar as a response.

{"query":"actionedByUserId==0a3687d0-611f-16a6-9870-ce4700001793;eventDate>2010-01-01T00:00:00Z;eventDate<2020-01-01T00:00:00Z","sort":null,"totalResultCount":0,"pagination":{"currentPage":1,"itemsPerPage":100,"totalItems":0},"results":[]}

Case System ID:

0a3687d0-626d-17eb-98ab-ba200009a055

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
4.2k 8 5 6

Hello @cliff.ching ,

Thank you for sharing the system case ID. I have checked the case and was able to replicate the issue. The reason you are unable to get the results is because you are using the wrong value in the key "actionedByUserId" in your payload. Please change the "actionedByUserId" to 0a3687cf-611f-145c-9870-ce2000001762 and this should work. I have tested it and was able to pull the results. Please find it in the attached.

cusersu6068964musicresponse-screened-case.txt

The user ID being used by you is actually the group ID of one of your groups-

Natixis Asia Limited - API (T) - Screening.

UserId is identifier of the user who screened the case and is different from the group ID.

How can you find the userId? By calling the API "Fetch full case details". I am pasting the response of the API below. Here you would find the user summary (refer schema reference document for more info) which would include the userId (in bold) too.

{
"caseId": "01beb839-3d37-4b13-be98-0cc7d93eccbd",
"name": "FAR EASTERN INDUSTRIES SHANGHAI LTD",
"providerTypes": [
"WATCHLIST"
],
"customFields": [],
"secondaryFields": [],
"groupId": "0a3687d0-611f-16a6-9870-ce4700001793",
"entityType": "ORGANISATION",
"caseSystemId": "0a3687d0-626d-17eb-98ab-ba200009a055",
"caseScreeningState": "INITIAL",
"lifecycleState": "UNARCHIVED",
"creator": {
"userId": "0a3687cf-611f-145c-9870-ce2000001762",
"firstName": "Eric",
"lastName": "",
"fullName": "",
"email": "",
"status": "ACTIVE"
},
"modifier": {
"userId": "0a3687cf-611f-145c-9870-ce2000001762",
"firstName": "Eric",
"lastName": "XXXX",
"fullName": "XXXXX",
"email": "eric.PPPPPP@XXXXXX.",
"status": "ACTIVE"
},
"assignee": null,
"creationDate": "2018-04-10T09:34:55.654Z",
"modificationDate": "2018-04-10T09:34:56.707Z",
"outstandingActions": true
}

Kindly let me know if you were able to call the API successfully now by accepting the answer.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.