We have a requirement where we need to send some data (like values entered on windows) to another software which exposes some web APIs/services. I know that using WebDev module in Ignition, we can write web service. Any other software can call that service to request the data. But in our requirement we need to send the data which getting any request from other software (probably on Button’s action performed event).
How can I do it in WebDev module? or anything else is required?
Please see my module RWS (restful web services) for two way communication with ignition from another application using webDev module. https://pramanj.com/
It can be customised to meet your requirements . It’s also possible to integrate remotely over internet using another module RMS from us which uses pubnub cloud services.
Please let me know your requirements
Sounds like you might just need the
system.net.httpPost scripting functions.
Thank you for your reply. I checked the documentation for these functions. Description of both mentions about retrieving document from given URL. So it seems like it is retrieving data from somewhere rather than giving/sending it.
Or as shown in the examples of system.net.httpPost, second parameter (postParams) can be used to send data from Ignition to the destination url/web service? And WebDev module required to use these functions?
As mentioned by @Kevin.Herron you can send data using either
system.net.httpPost, which one to use will depend on the service that will receive the call.
I don’t think you need the webdev module to be able to use those functions.
We have a Gateway Script with the function to do the call,
myEndpoint = "http://server/api/exposedAPI.php?"
myEndpoint += "MachineID=" + str(MachineID) + "&"
myEndpoint += "TagID=" + str(TagID)+ "&"
myEndpoint += "Value=" + str(Value)
response = system.net.httpGet(myEndpoint)
except Exception, ex:
LogErrorMessage("UpdateData_API", myEndpoint + " failed... Something went wrong..." + str(ex.message))
And to call it we use something like this;
MachineID = "somevalue"
TagID = "somevalue"
Value = currentValue.value
Using webDev on Ignition server, an external application can pull or request a data from Ignition server, and with
system.net.httpPost you can push the data from Ignition server (or client) into an external application thru the exposed end points in that server…
system.net.httpPost uses the POST HTTP verb, as the name implies. In basically every web API, POST is the way you submit data, and GET (ie,
system.net.httpGet) is the way you retrieve data. “Proper” REST endpoints may also support PUT, PATCH, and other HTTP methods, but GET and POST covers probably 90% of cases.
You do not need the Webdev module to use either function. WebDev serves the specific purpose of enabling you to use Ignition’s built-in webserver to build your own web APIs, or serve your own files, directly - but webdev endpoints are, by definition, the target of other services, not the source.
Thank you folks for your reply.
@PGriffith Thank you for detailed reply. It clarified many questions. I got confused due to similar description (with word ‘retrieve’) for both httpPost and httpGet in 7.9 user manual and my limited knowledge of webservice/API stuff. It’s clear now.
@Neo Please also see our new extension to RMS module for interacting with Ignition remotely thru PubNub. It coulld be of some interest to you as well.
@PGriffith Yes indeed system.net.httpPost/Get functions are more suited here but the end points have to be created in the other application. RWS may not be ideal here, though it can do the job in a round about way…
I haven’t explored system.net.httpPost/Get functions but it does give me couple of ideas to try! Can these work across the firewall?
Thanks for the insight.