Assigning roles to existing ClaimContacts
Once a ClaimContact exists on a claim (with at least one role), you can modify its roles.
Assigning reserved roles
To assign a reserved role to an existing ClaimContact, PATCH the role field or array on the object that owns the role. If the role can be held by only one ClaimContact, then the role is switched from any ClaimContact that previously held it to the one specified in the PATCH.
For example, the following request assigns the role of reporter on claim cc:402 to existing ClaimContact cc:8181. The previous ClaimContact to have the reporter role will no longer have it.
Command
PATCH /claim/v1/claims/cc:402
Request body
{
"data": {
"attributes": {
"reporter": {
"id": "cc:8181"
}
}
}
}
Assigning non-reserved roles
To assign a non-resolved role to an existing ClaimContact, PATCH the
editableRoles
array of the ClaimContact itself.
For example, the following request PATCHes ClaimContact cc:777 on claim cc:610 so
that it has the alternate contact role (whose code is
altcontact
) on the claim itself.
Command
PATCH http://localhost:8080/cc/rest/claim/v1/claims/cc:610/contacts/cc:777
Request body
{
"data": {
"attributes": {
"editableRoles": [
{
"role": {
"code": "altcontact"
},
"relatedTo": {
"type": "Claim",
"id": "cc:610"
}
}
]
}
}
}
Similarly, the following request PATCHes ClaimContact cc:208 on claim cc:610 so that
it has the owner role (whose code is incidentowner
) on the
vehicle incident whose ID is cc:102. (In other words, ClaimContact cc:208 is the
owner of the vehicle specified in vehicle incident cc:102.)
Command
PATCH http://localhost:8080/cc/rest/claim/v1/claims/cc:610/contacts/cc:208
Request body
{
"data": {
"attributes": {
"editableRoles": [
{
"role": {
"code": "incidentowner"
},
"relatedTo": {
"type": "vehicleIncident",
"id": "cc:102"
}
}
]
}
}
}
Keep in mind that, within Cloud API , PATCHing an array does not add new members to the existing members. It replaces the existing members with the new members. If you want to add members to an array, you must first determine the existing members, and then specify an array with those members and the ones you wish to add. For more information, see PATCHes.
PATCHing editableRoles
scenarios
When PATCHing editableRoles
, the following table details the
possible request payloads and they way Cloud API will respond.
If the request payload contains... | ...then... |
---|---|
No editableRoles array |
The non-reserved roles on the ClaimContact remain unchanged. |
An editableRoles array with one or more
non-reserved roles |
The existing non-resolved roles are replaced by the non-reserved roles specified in the payload. |
An empty editableRoles array |
All existing non-reserved roles are removed. (However, if this would result in the ClaimContact no longer having any roles, Cloud API returns an error.) |
An editableRoles array with one or more reserved
roles |
Cloud API returns an error. |
A roles array (which is read-only) |
Cloud API returns an error. |