Additional activity functionality

The Common API contains these additional activity endpoints.

PATCHing activities

  • PATCH /activities/{activityId}

Working with activity notes

  • GET /activities/{activityId}/notes
  • POST /activities/{activityId}/notes

For more information on notes, see Notes.

Querying for activity documents

Use the following endpoints to query for documents associated with an activity:

  • GET /common/v1/activities/{activityId}/documents
  • GET /common/v1/activities/{activityId/documents/{activityDocumentId}

The first request retrieves a collection of documents associated with an activity. The second request retrieves a specific document by its id.

Query for collection of activity documents

The following example request retrieves the collection of documents associated with activity xc:SIplo6ocFYruNfFayiptz:

Command

GET /common/v1/activities/xc:SIplo6ocFYruNfFayiptz/documents

Response

{
    "count": 2,
    "data": [
        {
            "attributes": {
                "document": {
                    "displayName": "Incident8IBDXE0001.tif",
                    "id": "xc:SAVqYL88Yz7mJUmGnvbZd",
                    "type": "ClaimDocument",
                    "uri": "/claim/v1/claims/demo_sample:8008/documents/xc:SAVqYL88Yz7mJUmGnvbZd"
                },
                "id": "xc:SyP_J96xc7EWS3nItKdr5"
            }
        },
        {
            "attributes": {
                "document": {
                    "displayName": "OSHA8IBDXE0000.tif",
                    "id": "xc:SXXdaNGgEgeJJD3Ne4Z8f",
                    "type": "ClaimDocument",
                    "uri": "/claim/v1/claims/demo_sample:8008/documents/xc:SXXdaNGgEgeJJD3Ne4Z8f"
                },
                "id": "xc:SlcL8H6VzK1G-xSCDnYm4"
            }
        }
    ]
}

Query for activity document by id

You can use the earlier request for a collection of activity documents to get the activity id you need to retrieve that specific activity. The following example request retrieves the specific activity document xc:SyP_J96xc7EWS3nItKdr5:

Command

GET /common/v1/activities/xc:SIplo6ocFYruNfFayiptz/documents/xc:SyP_J96xc7EWS3nItKdr5

Response

{
    "data": {
        "attributes": {
            "document": {
                "displayName": "Incident8IBDXE0001.tif",
                "id": "xc:SAVqYL88Yz7mJUmGnvbZd",
                "type": "ClaimDocument",
                "uri": "/claim/v1/claims/demo_sample:8008/documents/xc:SAVqYL88Yz7mJUmGnvbZd"
            },
            "id": "xc:SyP_J96xc7EWS3nItKdr5"
        }
    }
}

Deleting activity documents

Use the following endpoint to delete a claim document from an activity:

  • DELETE /common/v1/activities/{activityId}/documents/{activityDocumentId}
Note: This request deletes the link between the claim document and the activity. It doesn't delete the claim document itself.
To delete a claim document from an activity, the user must know the activity document's id. To identify the activity document's id, use the following endpoint:
GET /common/v1/activities/{activityId}/documents/{activityDocumentId}
The id in the response refers to the activityDocumentId.

Once you know the activity document's id, you can delete the document from the activity. For example, the following request deletes document xc:S7Nd8pt4VR_cOEhq086CY from an activity:

Command

DELETE /common/v1/activities/xc:SIplo6ocFYruNfFayiptz/documents/xc:S7Nd8pt4VR_cOEhq086CY

When the request is successful, the API returns an empty body.

Creating activity documents

Use the following endpoint to attach a claim document to an activity associated with that claim:

  • POST /common/v1/activities/{activityId}/documents
A user can only attach a document to an activity if the following are true:
  • The document already exists on the claim the activity is associated with. To identify the claim an activity is associated with, use the following endpoint:
    GET /claim/v1/claims/{claimId}/activities
    To retrieve the collection of documents attached to a claim, use the following endpoint:
    GET /claim/v1/claims/{claimId}/documents
  • The activity has an "open" status code. To retrieve the collection of activities associated with a claim, along with their statuses, use the following endpoint:
    GET /claim/v1/claims/{claimId}/activities
  • If the document has a securityType code of "sensitive", the user must have the correct permissions to view and add the claim document to an activity. If the user doesn't have the permissions to do so, the document will not exist for the user.

For example, the following request attaches claim document xc:SAVqYL88Yz7mJUmGnvbZd to activity xc:SIplo6ocFYruNfFayiptz:

Command

POST /common/v1/activities/xc:SIplo6ocFYruNfFayiptz/documents

Request

{
    "data": {
        "attributes": {
            "document": {
                "id": "xc:SAVqYL88Yz7mJUmGnvbZd"
            }
        }
    }
}

Response

{
    "data": {
        "attributes": {
            "document": {
                "displayName": "Incident8IBDXE0001.tif",
                "id": "xc:SAVqYL88Yz7mJUmGnvbZd",
                "type": "ClaimDocument",
                "uri": "/claim/v1/claims/demo_sample:8008/documents/xc:SAVqYL88Yz7mJUmGnvbZd"
            },
            "id": "xc:S7Nd8pt4VR_cOEhq086CY"
        }
    }
}

When the request is successful, the API returns the created activity document.

Note: The id in the example response refers to the activityDocumentId, and the id within the document object refers to the claimDocumentId.