Add attachments in a service portal

In the Consumer Service Portal (Service Portal), policyholders can add attachments to claims and policies. Adding an attachment is a multistage process that begins with using the multifileupload servlet to upload the file to the server and ends by including an attachment reference from the claim or policy to the file.

Adding an attachment to a loss event.
To add an attachment to a loss event, the portal calls the POST /multifileupload/v3 API to upload the attachment to the server and then the portal retrieves the name from the response. Finally, the portal provides the document’s file name when it calls the POST /claimevents endpoint to submit the loss event.
Adding an attachment to an existing claim
To add an attachment to a claim, the portal calls the POST /multifileupload/v3 API to upload the attachment to the server and then the portal retrieves the name from the response. Finally, the portal calls the POST /claims/systemId/documents endpoint to add a attachment reference to the claim.
Add an attachment to a policy
To add an attachment to a policy the portal calls the POST /multifileupload/v3 API to upload the attachment to the server and then the portal retrieves the name from the response. Finally, the portal calls the POST /policies/systemId/documents endpoint to add a attachment reference to the policy.
Note: When you upload two files in a single attachment, use the compositeFile section of the request body to indicate the file names.

Example: Add an attachment to a policy

This example provides the steps to add one or more files as an attachment to a policy. Similar steps apply to adding an attachment to a claim.

  1. The service portal executes the following API call to upload files to the server:
    API
    POST /multifileupload/v3
    Request Body filename: filename(s)
    For example:
    Example multifileupload API request
    The API response includes the name(s) of the files you reference when submitting the API to create an attachment.
    For example:
    {	
    	"files": [
    		{
    			"name": "joystick.png".
    			"size": 4321
    			"thumbnailUrl": "innovation?rq=File&Filename=/data/upload/joystick-thumb.png"
    		}
    	]
    }
  2. The service portal performs the following steps to identify the attachment template:
    1. The portal submits the following API call to get a list of attachment templates:
      Endpoint
      GET /attachmentTemplates?container=ContainerType&containerRef=containerSystemID

      For example: GET /attachmentTemplates?container=Policy&containerRef=484

    2. The service portal provides the policyholder a list of available attachment templates, based on the API response, and the policyholder selects one.
    3. From the API response, the service portal notes the id of the attachment template that the policyholder wants to use to create the attachment.
      For example:
      {
        "attachmentTemplateListItems": [
          {
            "id": "HOPAPolicyAttachment0001",
            "name": "Proof of Prior Insurance",
            "_links": [
              {
                "rel": "self",
                "href": "https://hostname/coreapi/v5/attachmentTemplates/HOPAPolicyAttachment0001?
                      container=Policy&containerRef=484"
              }
            ]
          },
          ... 
          {
            "id": "PolicyAttachment3003",
            "name": "Miscellaneous",
            "_links": [
              {
                "rel": "self",
                "href": "https://hostname/coreapi/v5/attachmentTemplates/PolicyAttachment3003?
                      container=Policy&containerRef=484"
              }
            ]
          },
      ...
  3. To add an attachment, the service portal performs one of the following steps:
    • To upload one file as an attachment, it executes the following API call::
      Endpoint
      POST /policies/systemId/documents
      Example Request Body
      {
        "templateId": "PolicyAttachment3003",
        "description": "Picture",
        "filename": "joystick.​png",
        "memo": "Accident picture"
      }
      • The templateId is the id associated with the attachment template.
      • The filename is the name field from the multipfileupload/v3 API response.
      Note: The values will differ based on user input.
    • To upload multiple files in a single attachment, it executes the following API call::
      Endpoint
      POST /policies/systemId/documents
      Example Request Body
      {
        "templateId": "PolicyAttachment3003",
        "description": "Pictures",
        "filename": "",
        "memo": "Accident picture",
        "compositeFile" : [
        {
         "filename" : "AttachmentA.​jpg"
        },
        {
         "filename" : "AttachmentB.​jpg"
        }
       ]
      }
      • Pass an empty string in the initial filename parameter. In the example above, "" indicates an empty string.
      • The filename fields in the compositeFile section of the request body are the name fields from the multipfileupload/v3 API response.
      Note: The values will differ based on user input.