The EWAttach operation attaches a file to a field in a record; the file is passed in the body of the request, and the URL must specify the record ID, the name of the field, and the file name to assign to the file. 

Browsers do not support sending PUT requests. This REST operation is intended for the use of application clients. If you need to attach a file from a browser, use the regular POST requests with EWCreate or EWUpdate operations, and specify enctype="multipart/form-data" in the browser HTML form.

Example

Assume an instance of  is available on localhost, port 8080 and is called "Demo". Attach a file to the field "someField" in record 1234 of table "someTable" with a file name as testfile.zip.

The request has to be issued via the PUT HTTP method where the body contains the content of the file to be attached. 

https://localhost:8080/ewws/EWAttach?$KB=Demo$table=someTable&$login=admin&$password=qwerty&id=1234&field=someField&fileName=testfile.zip

The following result will be returned when the file is attached: 

 EWREST_someField.length='1';
<form method="post" action="https://demo.agiloft.com/ewws/EWCreate" enctype="multipart/form-data">
<input name="$KB" value="Demo" />
<input name="$table" value="case" />
<input name="$lang" value="en" />
<input name="$login" value="admin" />
<input name="$password" value="qwerty" />
<input type="file" name="inbound_attachments"/>
<input type="submit" value="submit" />
</form>

Related articles