Skip to main content
1-Visitor
January 31, 2021
Question

Custom lua function call in lua services defined in templates of lua resource of EMS

  • January 31, 2021
  • 1 reply
  • 985 views

Hi,

I have below lua script which is calling external REST API.

 

local https = require("ssl.https")
local one, code, headers, status = https.request{
method = "POST",
url = "https://<ip>:<port>/<service_path>"
headers = {
["Content-Type"] = "application/json"
}
}

 

This script is working fine independently.

 

Now I want to integrate with the edge device on EMS. This script should be executed by the remote service defined on edge device in template file of lua resource in EMS.

 

I tried integrating the script in the lua files of thingworx. But, whenever I add the very first line "local https = require("ssl.https")", remote properties and services are not visible on Thingworx remote thing.

 

Can anyone guide me how to do the integration of above script in the lua service definition in template files OR is there any other way to call the external REST

1 reply

Support
February 11, 2021

Hi @aschauhan647.

 

Can you provide the full script so we can take a look?  You can scrub any sensitive information that you would not want to reveal.

 

Regards.

 

--Sharon