SBM ModScript Reference → Programming SBM ModScript → Constants → HTTPVerbConstants
Global const object for RESTDataSource.Call().
SBM ModScript version: 11.4.
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();
}
Copyright © 2007–2020 Micro Focus or one of its affiliates. All rights reserved.