Page tree
Skip to end of metadata
Go to start of metadata

REST - Attach

The EWAttach REST operation:

  • Attaches the file passed in the body of the request to the specified field of the record identified by the supplied primary key. 
  • Accepts the URL with parameters as per general URL conventions which can be viewed in the REST Interface Overview. Additionally, the URL must contain the identifier of the record, the name of the field to attach the file to and the file name to use. The file content is passed in the body of the request. 
  • Returns the current number of files attached to the specified field. 
  • All parameters must be properly URL-encoded.
  • At present 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  Agiloft is available on localhost, port 8080 and is called "Demo". Attach a file to the field "someField" in record 1234 of table "someTable". 

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

http://localhost:8080/ewws/EWAttach?$KB=Demo$table=someTable&$login=admin&$password=qwerty&id=1234&field=someField

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

 EWREST_someField.length='1';
Example code
<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>

CONTENTS