Add attachments in an agent portal
In an agent portal, consumers can add attachments to applications and policies.
Adding an attachment to a container, such as an application or policy, is a multistage
process:
- Upload the file.
- Add an attachment reference from the container to the uploaded file.
Upload the file
Creating an attachment begins with uploading the file to the server using the
multifileupload/v2
servlet and then identifying the file name of the
document.
For example, the following steps may occur:
- The agent portal executes the following API call:
API POST /multipfileupload/v2
Request Body image: filename
For example: - From the API response, note the file name:
For example:
{ "files": [ { "name": "joystick.png". "size": 4321 "thumbnailUrl": "innovation?rq=File&Filename=/data/upload/joystick-thumb.png" } ] }
Identify the attachment template
After an agent identifies a policy or application that requires an attachment, the agent portal calls an API to determine the list of applicable attachment templates. Once the agent selects one of the templates, the agent portal notes the template ID of the attachment as it is required to create the attachment.
For example, the following steps may occur:
- The portal submits the following API call:
GET /attachmentTemplates?container=ContainerType&containerRef=containerSystemID
- Application example:
GET /attachmentTemplates?container=Application&containerRef=6290
- Policy example:
GET /attachmentTemplates?container=Policy&containerRef=484
- Application example:
- The portal provides the agent a list of available attachment templates based on the API response and the agent selects one.
- From the API response, the portal notes the id of the
attachment that the agent wants to create.
- Application
example:
{ "attachmentTemplateListItems": [ { "id": "XApplicationAttachment0015", "name": "Signed Application Form", "_links": [ { "rel": "self", "href": "https://hostname/coreapi/v5/attachmentTemplates/XApplicationAttachment0015?container=Application&containerRef=6290" } ] }, { "id": "PApplicationAttachment0003", "name": "Inspection", "_links": [ { "rel": "self", "href": "https://hostname/coreapi/v5/attachmentTemplates/PApplicationAttachment0003?container=Application&containerRef=6290" } ] }, ... { "id": "ApplicationAttachment3003", "name": "Miscellaneous", "_links": [ { "rel": "self", "href": "https://hostname/coreapi/v5/attachmentTemplates/ApplicationAttachment3003?container=Application&containerRef=6290" } ] },
- Policy
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" } ] }, ...
- Application
example:
Add an attachment reference
The steps to attach a document differs based on the container or resource type:
- Adding an attachment to an application
- To add an attachment to an application, execute the following API:
Endpoint POST /applications/systemId/documents
Example Request Body
Provide the name from the{ "templateId": "ApplicationAttachment3003", "description": "Picture", "filename": "joystick.png", "memo": "Accident picture" }
multipfileupload/v2
API response as the filename in this request.Note: The values will differ based on agent input.
- Adding an attachment to a policy
-
Endpoint POST /policies/systemId/documents
Example Request Body
Provide the name from the{ "templateId": "PolicyAttachment3003", "description": "Picture", "filename": "joystick.png", "memo": "Accident picture" }
multipfileupload/v2
API response as the filename in this request.Note: The values will differ based on agent input.