Expose Ignition tags to WebDev applications

I have successfully created a simple WebApp written in HTML / javascript which is hosted on the ignition gateway via the WebDev module.

I have used ajax GET and POST methods in the WebApp to talk to SQL tables via python resources.

What i am trying to do now is be able to write a GET / POST script in python resource that will allow me to read and write Ignition tags from the WebApp.

I tried a basic example of sending a tagPath string from the WebApp and tried reading the tag and sending the value back. But ran into the issue of not being able to pass “/” as part of a tagPath variable in an ajax GET method.

What is the best way to properly expose tags to a web interface?

Here is the example i have tried, hardcoding the tagPath into the python resource directly (still doesn’t work).

Javascript code in WebApp:

    formData = {"tagPath": tagPath};

        type: "GET", 
        url: "../python/tag",
        data: formData,
        success: function(result){
        error: function(){
            console.log("Error with getTag function");
        contentType: "application/x-www-form-urlencoded"

Python GET method Code in Ignition WebDev module ‘tag’ resource:

def doGet(request, session):
	import system
	#tagPath = request['params']['tagPath']
	#tagVal = system.tag.read('temp/'+tagPath).value
	tagVal = system.tag.read('temp/testMemReal').value
	return {'json': system.util.jsonEncode(tagVal)}

Have you tried using the tag provider in the tag path?

Ah yep, adding [default] to start of the tagpath worked, and i can now read and write tags.
Awesome, thanks!

Is it possible to read and write Array or Dataset tags through this method? Doesn’t seem to be working.

Not sure… might need to be on 7.9 for it to work.

HI Kevin,

Can you please help the value what i have to place in tagpath…