Skip to main content

Import Files

MethodDescription
uploadfileUpload a file to a folder on the server.
attachFilesAttach existing files to existing records.

Upload Files Method

Upload a file to a folder on the server.
If you want to attach the file to an existing record, make sure to include the field "rows" - an array of objects that represent the combinations (recordType and recordId)

REST APIFilesApi/uploadfile

file Data

The following parameters should be included in a formdata object (see example below)

FieldName-transTypeDescriptionתיאורDefault
file
Required
fileקובץFile object
folder
Required
stringשם תקיהFolder name
publicPublic=1
Not public=0
ציבוריpublic0
typestringסוג קובץtypetype
DescriptionString (max 50)תאורdescriptionEmpty value
rowsSee table belowמערך של צירופיםArray of combinations

rows Data

The following parameters should be included in a JSON.stringify rows (see example below)

FieldName-transTypeDescriptionתיאור
recordType
Required
‘acc’-for accounts
‘itm’-for items
‘docs’-for documents
‘jurn’- for jurnal trans
סוג רשומהType of record
recordId
Required
string מזהה רשומהrecord id

form-data Example

formData: {
'file':fs.createReadStream('C:/images(1).jpg'),
'folder': 'תמונות',
'public': '1',
'type': 'type',
'Description': 'report',
"rows": JSON.stringify([
{
"recordType": "itm",
"recordId": 8600,
},
{
"recordType": "acc",
"recordId": 8600,
}]
)
},

uploadfile OutputData

NameOptions
statusCode200 – OK / 500 - Errors
status
newIDID of the newly created record
errorsOK / Errors: "error description" / No Permission

How to upload a file via Postman

From the web: https://makolyte.com/how-to-upload-a-file-with-postman/

In the Body tab, select the form-data option. Then hover your mouse over the row so you can see a dropdown appear that says Text. Click this dropdown and set it to File.

Set type to file

Fill in the key name file. Finally, click the Select Files button (the name may be different depending on which version of Postman you’re using):

fill in "file" in key and select "files"

Clicking Select Files will open a file selection dialog window. Select one file. Now you’ll see the selected filename in the Value column:

Select a file

Fill in the other fields

fill in file, folder, public, type and description

If you're adding rows make sure to attach the following:

Set type to file

warning

Postman doesn't support Hebrew file names.

Attach File Method

Attach existing files to existing records.

REST APIFilesApi/attachFiles
ParametersDescriptionParameter Options/value
rowsobject name contains dataSee table below

file Data

FieldName-transTypeDescriptionתיאור
recordType
Required
‘acc’-for account
‘itm’-for item
‘docs’-for documents
‘jurn’- for jurnal trans
סוג רשומהType of record
recordId
Required
string מזהה רשומהrecord id
fileId
Required
integer numberמזהה קובץFile id

JSON Example

{
"rows":[ {
"recordType": "jurn",
"recordId": 8600,
"fileId": 10146
},
{
"recordType": "acc",
"recordId": 8600,
"fileId": 10150
}
]
}

attachFiles OutputData

NameOptions
statusCode200 – OK / 500 - Errors
status
errorsOK / Errors: "error description" / No Permission