How do I get a list of the projects on a gateway?

I would like to get a list of the projects on a gateway. As a workaround I am using system.net.httpGet() to get the /main/web/home source and using a regex ‘/([^/]+).jnlp’ to strip out the .jnlp file names, which seems a little hackish. Is there a cleaner way?

There’s no ready to use scripting API for this. You might be able to make something a little cleaner using the web dev module, if you have access to that.

def getProjects():
	import urllib2
	from xml.etree import ElementTree as ET
	projects_xml = urllib2.urlopen('http://10.1.1.81:8088/main/system/projectlist').read()
	projects = ET.fromstring( projects_xml ).findall('client')
	project_names = tuple( ( project.get('name'), project.find('title').text ) 
						for project in projects )
	return project_names
3 Likes

Were working a expanding are EAM dashboard, and having a build in API for getting all of the projects in a gateway using the gateway network would make life a lot easier as where trying to pulling more and more data into are dashboard. And to use the gateway network you need the project names.

In the meantime: Project List - Include hidden projects

Edit: oops, that method is already posted in this thread.

Hello Kevin,

This thread was so helpful.
As we are managing multiple gateways. We were trying to create a automated project list from all gateways with the help of this link ‘http://hostname:8088/main/system/projectlist ’ . But when were testing this we observed that
This xml page has only vision projects list and that too atleast one project resource like vision window/template have to be created in the project to get it listed.
But, Is there a way to extract the list of every project in a gateway(either let it be only perspective/only vision/or both/blank project)

Thanks.

I think you’d need to build something custom using the WebDev module as suggested above.

Hi Kevin,

Are there developments planned for the EAM? It seems like this is an underdeveloped module that has a lot of administration benefit potential.

We recognize the potential for the EAM module and have discussed a number of features we may implement in the future but in the near term it doesn’t look like the module is going to get much attention aside from bug fixes and some refactoring to improve the foundation. There’s just too much other stuff going on that has been prioritized over EAM features right now.

Get Perspective pages and URLs to make a directory or navigation page (NOT Vision projects)

If you are on 8.1.4, take a look at the system.perspective.getProjectInfo function. This is a new function with this release and it will list URLs and the page the URL references, which is what I’ve been racking my brain how to accomplish for some time. Here are the release notes: Ignition Release Notes for Version 8.1.4 | Inductive Automation (search for getProjectInfo()).

Example (to get a list of objects that contain the URL and primary view):
system.perspective.getProjectInfo()['pageConfigs'] returns

[
    {"url": "/", "primaryView": "path/to/view"},
    {"url": "/first", "primaryView": "path/to/view1"},
    {"url": "/second", "primaryView": "path/to/view2"},
    ...
]

Here is the documentation page for this function: system.perspective.getProjectInfo - Ignition User Manual 8.1 - Ignition Documentation

1 Like

This seems to be a pretty simple and clean way of getting a list of the project names via scripting:

from com.inductiveautomation.ignition.gateway import IgnitionGateway

projectNames = list(IgnitionGateway.get().getProjectManager().projectNames)
3 Likes

Hey Chandler, I don’t see a lot of documentation on those objects, even in the SDK documentation. Do you know of any other documentation on these native objects?

Great solution, by the way. Thanks!

1 Like

IgnitionGateway is intentionally undocumented (it’s an internal class), but the important thing to know is that IgnitionGateway.get() gets you an instance that implements the GatewayContext interface, which you’ll notice does describe the getProjectManager() method.

I found out about it from another post on the forum a while back, and used the introspect function written by @pturmel to find what was available via IgnitionGateway.

See this for information on the introspect function:

1 Like

Hi, when I check this its showing error. Any idea about did they changed this to some other area as that import Ignition gateway is NA in com.inductiveautomation.ignition.gateway

Are you running the code in the script console?

IgnitionGateway will only work in the gateway scope.

Yes, I was running the script in script console. Can you give me little more details please.
http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/overview-summary.html

How to use this? when I checked the script that you ha provided in the above webpage its not showing the ignition gateway to import.
Am I missing something. Can you please elaborate, how to read that doc.?

As Paul mentioned a few posts up, the IgnitionGateway class is not documented because it is an internal class. He also mentioned that you can only import it in the gateway scope. Your script console is the designer scope. Scripts running on the gateway are the only place you will be able to import it. Examples of scripts that run in the gateway scope are tag change event scripts, scripts in perspective projects, and gateway event scripts.

2 Likes

Can you please provide me with a little more information. I need name , title and description. How I can get those details by using this.??

For some reason Page Title is not included in system.perspective.getProjectInfo(). In pageConfigs I can get url and primaryView but not the title.

Anyone knows why that was leaved out?