cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

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

aschauhan647
2-Explorer

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

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 1
slangley
23-Emerald II
(To:aschauhan647)

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

Announcements


Top Tags