UpdateFileAttachments

Adds, updates, or deletes file attachments on an item.

A POST JSON body is required.

Parameters

Name Type Description
UpdateFileAttachments Function

Adds, updates, or deletes file attachments on an item.

table
  • ID (integer)
  • UUID (string)
  • dbname (string)
  • name (string)

The table identifier.

item
  • ID (integer)
  • UUID (string)

The item identifier.

Post Data

Name Type Description
includeFile

(optional)

boolean

Use includeFile to return the base64-encoded contents of the file. Default is false.

Note: If one or more files are included in the response, the cumulative total of all files that are returned is limited to 50 MB in size. If the total size of the included files is greater than 50 MB in size, you will only receive the meta data about the file attachments in the response. To change the size limit for all files in the response, see solution S142607.
deleteAll

(optional)

boolean

Deletes all file attachments on the specified item. Default is false.

fileAttachFilter

(optional)

Array of identifiers
  • ID (integer or string)
  • FILENAME (string)
  • TITLE (string)

Include fileAttachFilter to filter the attachments that are returned. Otherwise, all file attachments are returned by default.

Note that you can pass any type of identifier in the array, or a combination of them in order to return the desired attachments.

fileAttachList

(required)

FileAttachList

Array of file attachments that you want to add, update, or delete.

Example

URL:

http://AEserverName/jsonapi/UpdateFileAttachments/1000/140

Post data:

{
  "deleteAll":false,
  "includeFile":false,
  "fileAttachFilter": [ "" ],
  "fileAttachList": [ {
    "action":"DELETE-FILE",
    "id":0,
    "title":"log file",
    "filename":"logfile.txt",
    "accessType":"",
    "showAsImage":""
  },
    {
    "action":"NEW-ONLY",
    "id":46,
    "title":"abc",
    "filename":"abc.txt",
    "contentsbase64": {
      "data":"QUFB...MzMzMw=="
    },
    "accessType":"ATTACHACCESS-UNRESTRICTED",
    "showAsImage":"false"
  }                   
 ]
}

Response:

{
 "fileattachments": {
  "files": [{
   "id": 58,
   "title": "abc",
   "fileName": "abc.txt",
   "fileSize": 70,
   "showAsImage": false,
   "modificationDateTime": 1532450986,
   "accessType": "ATTACHACCESS-UNRESTRICTED",
   "url": "http://AEserverName:80...AttachmentPage&AttachmentID=58/abc.txt"
  }],
 },
 "result": {
  "type": "OK",
  "msg": ""
 }
}

Comments

Note: The Maximum File Size setting in the Settings | Attachments tab in SBM System Administrator determines the size limit for file attachments that you can add to an item. The default maximum size is 500 MBs. However, use caution when adding or updating large files manually or in an automated manner, as this can negatively impact system performance.