JSON API Guide → Reference → POST Functions → UpdateFileField
Adds, updates, or deletes files in a File field on an item.
A POST JSON body is required.
Name | Type | Description |
---|---|---|
UpdateFileField | Function |
Adds, updates, or deletes files in a File field. |
table |
|
The table identifier. |
item |
|
The item identifier. |
field |
|
The File field identifier. |
transition (optional) |
|
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. |
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
|
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. |
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." } }
Copyright © 2007–2019 Micro Focus or one of its affiliates. All rights reserved.