UpdateFileField

Adds, updates, or deletes files in a File field on an item.

A POST JSON body is required.

Parameters

Name Type Description
UpdateFileField Function

Adds, updates, or deletes files in a File field.

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

The table identifier.

item
  • ID (integer)
  • UUID (string)

The item identifier.

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

The File field identifier.

transition (optional)
  • ID (integer)
  • UUID (string)
  • internal name (string)
  • name (string)

The transition identifier to use. If 0, a valid Update transition is used (if found).

Tip: Run GetItemTransitions first to determine the transition identifier that you will specify.

Not all transitions have an internal name. Those that do return the internal name as dbname in the GetItemTransitions response.

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 files in the File field on the specified item. Default is false.

breakLock (optional) boolean

Allows the JSON API to steal the record lock from any user who might have one on this item, so that this call should not fail due to a user having the record locked. However, this causes any user who has a transition form open on this item to get an error when he or she tries to commit the transition. Default is true.

alwaysTrans (optional) boolean

If set to true, this runs the transition even if the File field was not changed. Default is false.

fileObjFilter

(optional)

Array of file identifiers
  • ID (integer or string)
  • UUID (string)
  • FILENAME (string)
  • NAME (string)

Include fileObjFilter to filter the files that are returned. Otherwise, all files 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 files.

fileObjList

(required)

FileObjList

Array of files that you want to add, update, or delete in a File field.

Example

URL:

http://AEserverName/jsonapi/UpdateFileField/1000/140/FILEFIELD/0

Post data:

{
 "deleteAll": false,
 "includeFile": false,
 "breakLock": true,
 "alwaysTrans": false,
 "fileObjFilter": ["Details"],
 "fileObjList": [{
  "action": "DELETE",
  "id": 0,
  "name": "Issue Details",
  "filename": "details.txt"
 },
 {
  "action": "NEW-ONLY",
  "id": 0,
  "name": "Details",
  "filename": "new_details.txt",
  "contentsbase64": {
   "data": "QUFBQUFB...MzMzMw=="
  }
 }
 ]
}

Response:

{
 "fieldFileObj": {
  "id": 189,
  "uuid": "c24c3001-a999-40fa-9dd8-42b0fc728ea5",
  "name": "FileField",
  "dbname": "FILEFIELD",
  "fldtype": 132,
  "fldtypelabel": "file",
  "fileObjList": [{
   "id": 26,
   "uuid": "8560f131-78fe-481d-8800-56d596195f82",
   "name": "Details",
   "filename": "new_details.txt",
   "filesize": 70,
   "fileurl": "http://AEserverName...FileObjectPage&FileObjId=26/new_details.txt"
  }],
   "fileObjCount": 1
  },
  "result": {
   "type": "OK",
   "msg": "The item was successfully transitioned.",
   "msgLoc": "The item 1000:140 was successfully transitioned."
 }
}

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.