Log to Domino using JSON


<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
	<xe:restService id="restService1" pathInfo="logger"
		ignoreRequestParams="true">
		<xe:this.service>
			<xe:customRestService requestContentType="application/json"
				requestVar="job" contentType="application/json">

				<xe:this.doPost><![CDATA[#{javascript:try{
	var o = new Object(job)
	var d = database.createDocument()
	d.replaceItemValue("Form","Log");				
	d.replaceItemValue("LogEvent",o.LogEvent);				
	d.replaceItemValue("LogSource",o.LogSource);	
	d.replaceItemValue("LogType",o.LogType);
	d.replaceItemValue("LogBody",o.LogBody);
	d.computeWithForm(false,false)			
	d.save()
	return "Domino LogEvent registered"
}catch(e){
	print("ERROR " + e);
}}]]></xe:this.doPost>
			</xe:customRestService>
		</xe:this.service>
	</xe:restService>
</xp:view>





{
    "LogType": 1,
    "LogSource": "Db1",
    "LogEvent": "Event"
    "LogBody": "Body"   
}
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...