
Attachment folder is generally a shared folder on Windows platform for SAP Business One Client. SL runs on Linux and thus is not allowed to directly access this shared folder. In order to make the attachment folder accessible for SL as well, the Common Internet File System (CIFS) is required. For more information about CIFS, you can visit:
1. Create a network shared folder with read and write permissions on Windows (e.g. \\10.58.32.131\temp\andy\attachments2) and configure it as the attachment folder in General Settings
in B1 client:
2. Create a corresponding attachment directory on Linux. (e.g. /mnt/attachments2)
3. Mount the Linux folder to Windows folder by running a command like this:
mount -t cifs -o username=xxxxx,password=******,file_mode=0777,dir_mode=0777 "//10.58.32.131/temp/andy/attachments2/" /mnt/attachments2
[How to auto mount when Linux server starts]
To facilitate the configuration convenience for customers, /etc/fstab
can be leveraged to automatically mount to Windows shared folder once Linux server reboots. One approach to achieve this is basically as below steps:
/etc/mycifspass
) with the below content:username=xxxxx password=****** file_mode=0777 dir_mode=0777
/etc/fstab
and append one line as below://10.58.32.131/temp/andy/attachments2/ /mnt/attachments2 cifs credentials=/etc/mycifspass 0 0For this case, uploading the source file (e.g. /home/builder/src_attachment/my_attach_1.dat) as an attachment by sending a request as below:
On success, the response is like:
and the source file is saved in the destination attachment folder on Linux (/mnt/attachments2):
Then open the Windows folder (\\10.58.32.131\temp\andy\attachments), you will find the source file is saved there as well:
One way to add an attachment on Windows is to use HTTP POST
method. The request MUST contain a Content-Type
header specifying a content type of multipart/form-data
and a boundary specification as: Always use HTTP POST
method to add an attachment. The request MUST contain a Content-Type
header specifying a content type of multipart/form-data
and a boundary specification as:
Content-Type: multipart/form-data;boundary=<Boundary>
The body is separated by the boundary defined in the Content-Type
header, like:
For example, if you want to pack two files into one attachment to post, send the request like:
On success, the response is like:
By default, the first attachment line is downloaded if there are multiple attachment lines in one attachment. To download it, $value
is required to append to the end of the attachment retrieval URL. For example:
GET /b1s/v1/Attachments2(3)/$value
On success, the response is like this in browser:
If you want to download the attachment line other than the first attachment line, full file name (including the file extension) needs to be specified in the request URL. For example:
GET /b1s/v1/Attachments2(3)/$value?filename='line2.png'
On success, the response is like this in browser:
SL allows you to update an attachment via PATCH
and there are two typical cases for this operation.
[Update an existing attachment line]
If the attachment line to update already exists, it is just replaced by the new attachment line. For Example:
On success, HTTP code 204 is returned without content.
HTTP/1.1 204 No Content
To check the updated attachment line, send a request like this:
GET /b1s/v1/Attachments2(3)/$value?filename='line1.txt'
On success, the response is like this in browser:
[Add one attachment line if not existing]
If the attachment line to update doesn't exist, the new attachment line is appended to the last existing attachment line. Example:
On success, HTTP code 204 is returned without content.
HTTP/1.1 204 No Content
To check the newly created attachment line, send a request like this:
GET /b1s/v1/Attachments2(3)/$value?filename='line3.png'
On success, the response is like this in browser:
[Note]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
9 | |
8 | |
4 | |
4 | |
4 | |
4 | |
4 | |
4 | |
4 |