The EWRemoveAttachment operation removes an attached file from a field in a record; the file is identified by its position in the field, in case multiple files are attached, and the URL must specify the record ID, the name of the field, and the position of the file to be removed.

JavaScript Example

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('https://localhost:8080/ewws/EWRemoveAttachment?$KB=Demo&$table=someTable&$login=admin&$password=qwerty&id=1234&field=someField&filePosition=1#39;
    }

Related articles