HTTPVerbConstants

Description

Global const object for RESTDataSource.Call().

Technical Details

SBM ModScript version: 11.4.

Example

var result = " ";
//Create AppRecord of RESTDATASOURCE table
var restSource = Ext.CreateAppRecord(Ext.TableId("TS_RESTDATASOURCE"));
restSource.ReadByColumn("TS_NAME", "JSONPlaceHolder1");
var sPostData = //Use Map with to_json to format JSON post data
       ["name": "myObjName", 
        "value1": 17, "value2": 5.7, 
		      "arrayData": [1,2,"3",4] //Use Vector for JSON array
	      ].to_json();
if (!restSource.Call(HTTPVerbConstants.PUT , result, sPostData)){
 // write an error to Event Viewer
	Ext.LogErrorMsg("Rest call failed in script " + __FILE__ + 
   ":\n" + Shell.GetLastErrorMessage() );
	
 // write an error to Active Diagnostics
	ADLog.Message( __FILE__, __LINE__, ADLogLevelConstants.ERROR, 
   "Rest call failed:\n" + Shell.GetLastErrorMessage() );
	
	Shell.RedoMessage() = "Rest call failed";
	
	ExitScript(); 
} 

Related Topics

Constants

RESTDataSource