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

REST - Remove Attachment

The EWRemoveAttachment REST operation:

  • Removes the attached file specified by the position in the named field of the record identified by the supplied key. 
  • Accepts the URL with parameters as per general URL conventions which can be viewed in the REST Interface Overview. The URL must contain the identifier of the record, the name of the field to remove the file from and the position of the file in the field. 
  • Supported Content-Type: application/x-www-form-urlencoded
  • Returns the number of files remaining attached in the field.

All parameters must be properly URL-encoded.

Here is an example for a JavaScript-based client that opens the REST interface via AJAX: 

 function xmlhttpGet (strURL) {
        var xmlHttpReq=false;
        var self=this;
        // Mozilla/Safari
        if (window.XMLHttpRequest) {
            try {
                netscape.security.PrivilegeManager.
                  enablePrivilege("UniversalBrowserRead");
            } catch (e) {
                alert("Permission UniversalBrowserRead denied.");
            }
            self.xmlHttpReq=new XMLHttpRequest();
        }// IE
        else if (window.ActiveXObject) {
            self.xmlHttpReq=new ActiveXObject("Microsoft.xmlHTTP");
        }
        self.xmlHttpReq.open('GET', strURL, true);
        self.xmlHttpReq.onreadystatechange=requestComplete;
        self.xmlHttpReq.send(null);
    }
    function requestComplete() {
        if (xmlHttpReq.readyState==4||xmlHttpReq.readyState=="complete") {
            eval (self.xmlHttpReq.responseText);
            alert ("Id of new ticket"+EWREST_id);
        }
    }
    function main() {
        xmlhttpGet('http://localhost:8080/ewws/EWRemoveAttachment?$KB=Demo&$table=someTable&$login=admin&$password=qwerty&id=1234&field=someField&filePosition=1#39;
    }

CONTENTS