Using the Batch Assess REST API

The assessor resource provides the ability to assess a batch of cases.

POST request

The basic structure expected for the POST request for the assessor resource is as follows:

{
    "outcomes" : [
        "global_input_attribute_1",
        "global_output_attribute_3",
        "child_output_attribute_2",
        "inferred_relationship_name",
        {
            "id": "global_output_attribute_4",
            "knownOutcomeStyle": "decision-report",
            "unknownOutcomeStyle": "decision-report"
        }
    ],
    "cases" : [
        {
            "@id" : 1,
            "global_input_attribute_1" : "attribute_value",
            "global_input_attribute_2" : 10,
            "containment_relationship_name" : [
                {
                    "@id" : 1,
                    "child_input_attribute_1" : "attribute_value"
                },
                {
                    "@id" : 2,
                    "child_input_attribute_1" : "attribute_value"
                }
            ]
        },
        {
            "@id" : 2,
            "global_input_attribute_1" : "attribute_value",
            "global_input_attribute_2" : 20,
            "containment_relationship_name" : []
        }
    ]
}

The two top-level properties of the request are:

Property Name Description
outcomes An array of text values identifying the attributes and relationships to be returned as outcomes for each case processed. Each value must be either a simple string value of attribute or relationship name, or an object with the properties listed in the table below.
cases An array of JSON objects representing the cases to be processed. The top-level JSON object for each case will be mapped against the global entity of the target policy model.

The properties of an outcomes object are:

Property Name Description
id (Mandatory) The attribute or relationship that the outcome applies to.
showSilent (Optional) Indicates whether to force show silent fields. Defaults to false. Equivalent to show-silent attribute from SOAP decision report.
showInvisible (Optional) Indicates whether to force show invisible fields. Defaults to false. Equivalent to show-invisible attribute from SOAP decision report.
resolveIndecisionRelationships (Optional) Indicates whether to expand relationships for indecision reports. Defaults to false. Equivalent to resolve-indecision-relationships attribute from SOAP decision report.
knownOutcomeStyle (Optional) Indicates the outcome style of the outcome for known values. Options are: "value-only", "decision-report", and "base-attributes". Defaults to "value-only".
unknownOutcomeStyle (Optional) Indicates the outcome style of the outcome for unknown values. Options are: "value-only", "decision-report", and "base-attributes". Defaults to "value-only".

For more information, including details of request size and concurrency limits, see Submit a request to the batch assess service.

POST response

The response returns the structured input data with identified outcome attributes populated, and includes a summary of the batch process. The response format looks like:

{
    "cases" : [
        {
            "@id" : 1,
            "@time : 0.3,
            "global_input_attribute_1" : "attribute_value",
            "global_output_attribute_3" : 105,
            "containment_relationship_name" : [
                {
                    "@id" : 1,
                    "child_output_attribute_2" : "attribute_value"
                },
                {
                    "@id" : 2,
                    "child_output_attribute_1" : "attribute_value"
                }
            ],
            "inferred_relationship_name" : [1, 2],
            "global_output_attribute_4" : true,
            "@decisionReports" : {
                "global_output_attribute_4" : {
                    "@id": "dn:0",
                    "attributeId": "global_output_attribute_4",
                    "value": true,
                    "text": "The attribute text.",
                    "type": "boolean",
                    "children": [
                        {
                            // ...
                        },
                        {
                            // ...
                        }
                    ]
                }
            }
        },
        {
            "@id" : 2,
            "@time" : 0.29,
            "global_input_attribute_1" : "attribute_value",
            "global_output_attribute_3" : 20,
            "containment_relationship_name" : [],
            "@decisionReports" : {
                "global_output_attribute_4" : {
                    "@id": "dn:0",
                    "attributeId": "global_output_attribute_4",
                    "value": null,
                    "text": "The attribute text.",
                    "type": "boolean",
                    "children": [
                        {
                            // ...
                        },
                        {
                            // ...
                        }
                    ]
                }
            }
        }
    ],
    "summary" : {
        "casesRead": 2,
        "casesProcessed": 2,
        "casesIgnored": 0,
        "processorDurationSec": 0.59,
        "processorCasesPerSec": 3.39,
        "processorQueuedSec": 0
    }
}

The two top-level properties of the response are:

Property Name Description
cases An array of JSON objects representing the processed cases. The content of the objects includes the values of the attributes and relationships identified as outcomes by the original request data, as well as the time taken to process each case.
summary An overview of the processing performed by the assessor

For more information, see Receive a response from the batch assess service.