Skip to Content

Documentation

Risk Cloud API: Export Attachments

Within Risk Cloud, you are able to add “Attachment” fields to your records enabling you to store files within Risk Cloud alongside your records. Once stored, these files can be exported via the Risk Cloud API.

Alternatively, to upload attachments to the Risk Cloud, refer to the article Risk Cloud API: Upload Attachments.

Obtain your API Access Token or pull the Risk Cloud Postman Collection to get started.

Export Attachment Endpoint

The Attachments API offers the following Export Attachment endpoint which returns a String of a URL to the image, based on the value ID of a value on a particular record’s attachment field.

Use Cases

Obtain Value ID

To obtain the value ID of a value on a particular record’s attachment field, use the Risk Cloud API: Record Search endpoint to view the fields and values of an attachment on a set of records, filterable by application, workflow, step, or a timestamp.

The value ID of an attachment field can be located in the response of the Record Search endpoint in the property content[].fields[].values[].id for fields where content[].fields[].values[].type is ATTACHMENT. In the below sample the value ID would be abcd1234 (ellipses are used to omit information for clarity).

Response

{
  ...
  "content": [
    {
      ...
      "fields": [
        {
          ...
          "values": [
            {
              "id": "abcd1234",
              "type": "ATTACHMENT",
              "textValue": "Evidence.pdf",
              "numericValue": 1.0,
              "object": "value"
            }
          ]
        }
      ]
    }
  ]
}

Obtain Attachment URL

Using the value ID obtained from the Record Search endpoint, make a request to the export attachment endpoint, which will return a String of a URL to the image.

This endpoint returns a String of the image URL in S3, meaning that the Accept header of the request should be either Accept: text/plain or Accept: */*.

Response

https://env-logic-gate.amazonaws.com/attachment/file_123456789.pdf

Get the Attachment

Finally, run a GET request directly on the returned URL to obtain the file. The file type for download can be inferred from the extension of the file name.