Advanced incident create options

We've already seen how to create an incident and supply data for any extendedFields that we might want to populate. After creating an incident, it is often the case that we also want to add some claimants and/or parties to the incident. While we can add these individually via the relevant endpoints, we also have the option to embed these additional claimants and parties into the initial incident create request.

Let's expand on the basic create request we introduced in the Create an incident page.

{
    "programmeCode": "8ffd4f55",
    "policyCountry": "GB",
    "policyTypeCode": "17ed9895",
    "incidentDate": "2022-04-01",
    "description": "Test incident from Claims Manager Api"
}

If we wanted to add a claimant to this incident in the same request, we can add the same claimant object that we would pass to the claimants endpoint, into the claimants array in the incident object.

{
    "programmeCode": "8ffd4f55",
    "policyCountry": "GB",
    "policyTypeCode": "17ed9895",
    "incidentDate": "2022-04-01",
    "description": "Test incident from Claims Manager Api",
	"claimants": [
		{
			"firstName": "John",
			"lastName": "Doe",
			"isOrganisation": false
		}
	]
}

The response from making this call will now include the claimantId of the newly created claimant as well as the generated incidentId.

{
    "incidentId": 6598139,
    "claimants": [
        736885
    ],
    "parties": null,
    "errors": null
}

As both the claimants and parties properties are arrays, we can add multiple claimants and parties in the same call if we wish.

{
    "programmeCode": "8ffd4f55",
    "policyCountry": "GB",
    "policyTypeCode": "17ed9895",
    "incidentDate": "2022-04-01",
    "description": "Test incident from Claims Manager Api",
	"claimants": [
	    {
	    	"firstName": "John",
	    	"lastName": "Doe",
	    	"isOrganisation": false
	    },
        {
            "firstName": "Jane",
	        "lastName": "Doe",
	        "isOrganisation": false
        }
	],
    "parties": [
        {
            "partyType": "Witness",
            "name": "John Smith"
        },
        {
            "partyType": "Police",
            "name": "Office Krupke"
        }
    ]
}

The response this time will include all claimantId and partyId values that were created for the additional records passed in the request.

{
    "incidentId": 6598140,
    "claimants": [
        736886,
        736887
    ],
    "parties": [
        288869,
        288868
    ],
    "errors": null
}

Limitations

Given that any claimants or parties embedded in the incident request cannot be added until after the incident has already been created, this request cannot be atomic. If any of the nested claimants or parties fail to be created, the request as a whole will not be aborted, what was successful will be persisted and any errors raised from the nested objects will be presented in the errors array.

Note that malformed claimant or party objects will still raise a validation error and a Bad Request response.