Import Files
Method | Description |
---|---|
uploadfile | Upload a file to a folder on the server. |
attachFiles | Attach 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 API | FilesApi/uploadfile |
file Data
The following parameters should be included in a formdata
object (see example below)
FieldName-trans | Type | Description | תיאור | Default |
---|---|---|---|---|
file Required | file | קובץ | File object | |
folder Required | string | שם תקיה | Folder name | |
public | Public=1 Not public=0 | ציבורי | public | 0 |
type | string | סוג קובץ | type | type |
Description | String (max 50) | תאור | description | Empty value |
rows | See table below | מערך של צירופים | Array of combinations |
rows Data
The following parameters should be included in a JSON.stringify rows
(see example below)
FieldName-trans | Type | Description | תיאור |
---|---|---|---|
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
Name | Options |
---|---|
statusCode | 200 – OK / 500 - Errors |
status | |
newID | ID of the newly created record |
errors | OK / 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.
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):
Clicking Select Files will open a file selection dialog window. Select one file. Now you’ll see the selected filename in the Value column:
Fill in the other fields
If you're adding rows make sure to attach the following:
Postman doesn't support Hebrew file names.
Attach File Method
Attach existing files to existing records.
REST API | FilesApi/attachFiles |
Parameters | Description | Parameter Options/value |
---|---|---|
rows | object name contains data | See table below |
file Data
FieldName-trans | Type | Description | תיאור |
---|---|---|---|
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
Name | Options |
---|---|
statusCode | 200 – OK / 500 - Errors |
status | |
errors | OK / Errors: "error description" / No Permission |