The EWCreate (POST) operation creates a record in the specified KB and table, and can include values for specified fields.
Assume an instance of is available on localhost, port 8080 and is called "Demo". Create a record for an employee named John Doe, that is assigned to the Service Manager group and Service Management Team, with login 'jdoe' and password 'password'.
Also, assume an instance of is available on localhost.
The following request is issued:
https://localhost:8080/ewws/EWCreate?$KB=Demo&$table=contacts.employees&$login=admin&$password=qwerty&$lang=en&first_name=John&last_name=Doe&_login=jdoe&password=password&f_group=:Service Manager&teams=:Service Management Team&_106_sw_description=:Service Management Team&_1576_company_name0=:Agiloft |
A result similar to the following will be returned in the case of successful record creation:
EWREST_id='353'; |
Here is an example of a JavaScript-based client that invokes 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/EWCreate?$KB=Demo&$table=contacts.employees&$login=admin&$password=qwerty&$lang=en&first_name=John&last_name=Doe&_login=jdoe&password=password&f_group=:Service Manager&teams=:Service ManagementTeam&_106_sw_description=:Service ManagementTeam&_1576_company_name0=:Agiloft'); } |
Related articles |