Files

GET {{host}}/api/rest/v4/data/entryfiles/{{entryId}}/fields/{{fieldId}}

Returns binary data, such as images or documents, stored in the system. To retrieve a file, provide the Entry ID and the Field ID in the path of the API request.

The Field ID specifies where the binary data is stored. Only field types of binary (fieldType: 13) or image (fieldType: 16) can store binary data.

Params

nameParameter TypeData TypeExampleDescription
entryIdPathint2013ID of the entry/record holding the specific binary file
fieldIdPathint1232ID of the binary or photo field

Attachments

With the exception of the Documents object, binary files themselves are stored within a special system (object) called Attachments. Any object can have an Attachment field, which is a reference field to the Attachment object under the hood.

Attachment Field & Object

See below an example of an Attachment Field. It references the Attachment object, where the actual binary is contained. When downloading a file, identify the record(s) that have attachments you want to download. You must then refer to the Attachment Object to find the field ID of the binary (file) field before you can retrieve the file data.

{
  "apiName": "Attachments",
  "fieldType": 5,
  "isRequired": false,
  "allowDuplicates": true,
  "warnOnNearDuplicates": false,
  "isMoney": false,
  "isMultiSelect": true,
  "entryLists": [2010],
  "systemFieldType": 10,
  "isKey": false,
  "isCalculated": false,
  "isAttachment": true,
  "isStoreRequestSupported": true,
  "id": 2212,
  "name": "Attachments",
  "entryListId": 2013
}

Workflow Steps: Downloading a File

Identify Records Containing Files for Download

Request

POST {{host}}/api/rest/v4/data/entrydata/get?wrapIntoArrays=true
Content-Type: application/json
Authorization: Bearer {{token}}
 
[
  {
    "entryId": 2772624,
    "fieldId": 2211
  },
  {
    "entryId": 2772624,
    "fieldId": 2212
  }
]
 

Response

[
  {
    "entryId": 2772624,
    "fieldId": 2211,
    "isNoData": false,
    "value": {
      "id": 2772624,
      "name": "Test Interactions",
      "entryListId": 2013
    },
    "requestedCurrencyCode": "RC"
  },
  {
    "entryId": 2772624,
    "fieldId": 2212,
    "rowId": 23555389,
    "isNoData": false,
    "value": [
      {
        "id": 3043023,
        "name": "Intapp REST API Guide_20201009.docx",
        "entryListId": 2010
      }
    ],
    "requestedCurrencyCode": "RC"
  }
]

Grab IDs of the Attachments

From the responses above, we can see that 3043023 corresponds to the ID of the attachment file we want to download.

Downloading File

Using the ID of the attachment(s) and knowing the ID of the Document/Binary field on the attachment list, we can request the binary data.

GET {{host}}/api/rest/v4/data/entryfiles/{{entryId}}/fields/{{fieldId}}

Remember: The entryId is the value we obtained in Step 1 and 2, but the fieldId is the binary field type from the Attachments list.

GET {{host}}/api/rest/v4/data/entryfiles/3043023/fields/2129

Response

200 OK
Content-Length: 245829
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: attachment; filename="REST API Guide_20201009.docx"; filename*=utf-8''REST%20API%20Guide_20201009.docx; size=245829

Errors

The following errors are possible.

  1. If use the field ID from the reference list instead of the attachment list you'll get this error.
400 Bad Request
{
  "message": "Field with Id \"2302\" does not exist"
}
  1. If you use a field ID from the attachment list but not the field ID of the binary field. The binary field call called document and is field Type 13.
404 Not Found
{
  "message": "File not found"
}