I want to know the methods in WebDev
i.e doGET is for reading the data or writing the data to the endpoint.
I used doGET and pass parameters(tags values) to the endpoints, so other system can use the JSON data and work on it.
and When there is value update from the other system I need to update the value into the ignition Tag value.
I am confused how I can write the data back to variable and it should be always checking if there is change of value so it will update the tag value.
Ignition cannot do the check. The remote system would decide when to write to the WebDev API. You would have an endpoint (typically POST) for writing.
WebDev is fundamentally about responding to a remote system's requests. Whether supplying requested data, setting data into Ignition, or taking some other action, it is all about responding.
if you want something that listens to changes you will need something else than an api. more like a mqtt or something, thnk there is a module for tags with that
We will update Json data every 1 minute from client side. and I will be reading the updated data into Ignition.
It is like writing the variable value in Json and passing to client and every 1 minute need to read the data from client and reflecting in tags
Depending on a few things, you'll need one of those:
- Ignition making a get request every minute to something that will return the json data.
Ignition is the client, 'something' is the server. The client is in charge of asking the data to the server.
This DOESN'T use webdev
- Something else making a post request every minute with json data to a webdev endpoint.
Ignition is the server, 'something' is the client. Here, the client is in charge of giving data to the server.
In both cases you end up with the data on ignition's side and you can do whatever you want with it.
Since you called the 'something' client, I'd point you to the second solution, but maybe you picked the wrong word ?
I have a client which is reading and writing data through rest API, so I wanted to read the live data coming from the client and show it in Ignition and save it in SQL database, and when write command given from Ignition it should pass it to the client through restAPI.
Additional things is anyone can guide. If connection is break between Ignition and client, when connection get established like after 5 minutes so that 5 minutes JSON data can be saved into SQL database.
This is not much clearer. Let's try and break things appart.
first things first: there's a server/client communication, does that include ignition, or is your ignition app a third party ?
I have system which is communicating with end devices and this system will read or write data through restAPI.
- I need to read the device data into Ignition and store in DB.
- Also I need to write to device data from Ignition
i think you will have to draw some example with some sample data, its hard to understand what you want to do
Option 1: Ignition is the client
- Set up a webAPI server in the other system, e.g., https://othersystem/DataEndpoint
- Set up a timer in Ignition. Every 60 seconds the timer would run a script:
- Ignition would use the httpclient to GET to https://othersystem/DataEndpoint and say "did anything change? do you have any new data for me?".
- If the other system says "yes. here is the new data"
- your script would save the new data to the database (or probably a SQL bound tag and let Ignition persist the new data and make the data available as a tag to all of the Ignition app)
- othersystem probably uses the GET call as a heartbeat and issues some type of alarm if it detects that the communication is broken
Option 2: Ignition is the server
- Set up a webAPI client in Ignition using the webdev module, e.g. https://myIgnitionGateway/DataEndpoint
- In othersystem, when the data changes it will PUT the new data to https://myIgnitionGateway/DataEndpoint
- Your script in webdev saves the data to the database (or SQL bound tag...)
- you probably have a Heartbeat endpoint on your webdev and othersystem calls it (PUT) on a regular basis. Your script in webdev updates a tag that is configured with appropriate alarming if the quality is bad (haven't heard from othersystem in a while) or othersystem PUTs an error value.
Option 2 will consume fewer resources and is a cleaner design. It does require more from othersystem, so if you don't control othersystem or the othersystem dev team isn't as sophisticated as you would like or as cooperative as you need then implement Option 1.
If there are multiple integration points with different teams controlling othersystem1, othersystem2, othersystem3, etc. then start with whichever is easier and quicker for the other temas and then offer the other option in a later version. You can support both at the same time.
Thanks alot for the solution with different options.
Its there any way if there is communication failure between Ignition and the system which is sending the data.
- The system will keep sending the data to endpoint as there is a communication failure the data will not be reflected in the ignition.
(i.e every 30seconds the data is sent by the system to ignition thought restAPI)
so if communication is failed for 2 minutes means we lost 4 data points
- How we can get those data into the ignition.
Whichever end does the calling will have to handle the errors. If you need to backfill missing data, the call will need to remember errors and do the backfill when a connection is re-established. Whichever end receives the calls will have to expose a mechanism in the web API to either supply missing data, or store missing data.
There is no magic wand.