Quintiq file version 2.0
|
#parent: #root
|
Method ApiResponesCheck (
|
String address,
|
String url,
|
Number port,
|
String postrequestbody
|
) as owning JSON
|
{
|
Description: 'Check if the https link is working'
|
TextBody:
|
[*
|
// Administrator Aug-18-2023 (created)
|
|
// for HTTPS requests:
|
i := HTTPInterface::Create( address, port);
|
//i := HTTPInterface::Create( address ,443);
|
info( address, url, port, postrequestbody );
|
|
i.URL(url);
|
//i.SSL(false);
|
i.SSL(true);
|
i.SSLKeystore('MyKeystore'); // created in the Config Utility
|
|
i.PostMethod(true); //it's a POST method
|
|
i.Call(postrequestbody); // Call's argument is for POST method's content.
|
htmlresult := i.Result();
|
|
htmlresponse := JSON::Parse( htmlresult );
|
|
code := htmlresponse.Get( "resultCode" ).GetString();
|
message := htmlresponse.Get( "resultMsg" );
|
data := htmlresponse.Get( "responseData" );
|
datalist := data.Get( "dataList" );
|
|
if( code = "1" )
|
{
|
info( "Data have been written into table" );
|
}
|
else
|
{
|
messagestring := " ";
|
if ( message.IsNull() )
|
{
|
messagestring := "No message returns!";
|
}
|
else
|
{
|
messagestring := message.GetString();
|
}
|
info( "Error! error code: " + code + ", error message: " + messagestring );
|
}
|
|
return &datalist;
|
*]
|
}
|