# Getting Perspective Project list from gateway

**URL:** <https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601>\
**Category:** Ignition\
**Tags:** ignition80, scripting, perspective\
**Created:** [June 10, 2022, 9:23am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601 "2022-06-10T09:23:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prahil\_S\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Prahil\_S\_Kumar1](https://forum.inductiveautomation.com/u/Prahil_S_Kumar1)\
**Post date:** [June 10, 2022, 9:23am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/1 "2022-06-10T09:23:11Z")

</div>

Hello Team, I have a query on, is there any possibility to get the perspective project list from the gateway, I need the list of Perspective projects alone. I searched the forum, I have found some information’s, but most of them were dead end. Does someone have any idea about this.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 10, 2022, 12:21pm UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/2 "2022-06-10T12:21:35Z")

</div>

There’s a function you can call

[https://docs.inductiveautomation.com/display/DOC81/system.project.getProjectNames](https://docs.inductiveautomation.com/display/DOC81/system.project.getProjectNames)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 10, 2022, 3:38pm UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/3 "2022-06-10T15:38:58Z")

</div>

If you just need possible Perspective projects, you can make an HTTP request against `http://$gatewayAddress/data/perspective/runnable-projects` - the response is a simple JSON structure.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 10, 2022, 8:09pm UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/4 "2022-06-10T20:09:27Z")

</div>

Oh, I missed that requirement. Oops. That’s useful to know!

---

<div class="post-metadata">

**Author:** ![Prahil\_S\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Prahil\_S\_Kumar1](https://forum.inductiveautomation.com/u/Prahil_S_Kumar1)\
**Post date:** [June 13, 2022, 3:41am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/5 "2022-06-13T03:41:26Z")

</div>

Thank you very much, This is what I’m expecting, one more doubt how to extract the contents, I found some script w.r.t vision projects in this forum itself , I will provide the script below, something like that is possible for perspective to extract the contents.

def getProjects():  
import urllib2  
from xml.etree import ElementTree as ET  
projects\_xml = urllib2.urlopen(‘[http://10.1.1.81:8088/main/system/projectlist](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

Please share your valuable thoughts.

---

<div class="post-metadata">

**Author:** ![Prahil\_S\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Prahil\_S\_Kumar1](https://forum.inductiveautomation.com/u/Prahil_S_Kumar1)\
**Post date:** [June 13, 2022, 6:27am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/6 "2022-06-13T06:27:06Z")

</div>

Thank you guys I found it, But anyway please let me know if you have some suggestion’s in that 2nd question which I had mentioned @paul-griffith @nminchin.

---

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [June 13, 2022, 6:34am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/7 "2022-06-13T06:34:08Z")

</div>

Cool, this is what I’m searching for these days. Thank you. one more thing to @paul-griffith @nminchin @Prahil_S_Kumar1 ,Do u have any document/manual  
http://$gatewayAddress/data/perspective/runnable-projects for this, how we can get these info.  
also do u have something similar like the json format for vision also.??

---

<div class="post-metadata">

**Author:** ![Prahil\_S\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Prahil\_S\_Kumar1](https://forum.inductiveautomation.com/u/Prahil_S_Kumar1)\
**Post date:** [June 13, 2022, 9:33am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/8 "2022-06-13T09:33:39Z")

</div>

I don’t know, I found an xml for getting the details from the vision. If your requirement is full projectlist that can utilized by Projectnames.  
For other queries may be @paul-griffith and @nminchin can help you.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 13, 2022, 3:37pm UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/9 "2022-06-13T15:37:07Z")

</div>

> [@Prahil\_S\_Kumar1](#):
>
> This is what I’m expecting, one more doubt how to extract the contents, I found some script w.r.t vision projects in this forum itself , I will provide the script below, something like that is possible for perspective to extract the contents.

`system.net.httpClient` natively 'understands' JSON format, so the implementation is extremely simple:

```auto
def getPerspectiveProjects():
	response = system.net.httpClient().get("http://localhost:8088/data/perspective/runnable-projects")
	return [project["name"] for project in response.json]

print getPerspectiveProjects()

```

If you're in the Vision client scope, you can use [`system.util.getGatewayAddress`](https://docs.inductiveautomation.com/display/DOC81/system.util.getGatewayAddress) to get the correct address to fill in for the request. If you're in a Perspective session or other gateway context already, then you can probably just hardcode the port the gateway is using.

> [@John\_S1](#):
>
> Do u have any document/manual for this

No. This is considered an "implementation detail" - it _could_ change between Ignition versions. If you're doing something outside of the first-party [system functions](https://docs.inductiveautomation.com/display/DOC81/System+Functions), you are generally expected to be able to deal with problems on your own.  
In this particular case, it's fairly unlikely we change this route anytime soon, so it's probably safe to rely upon. I _would_ recommend implementing your own `getPerspectiveProjects` function (as I did above) in the project library and always using that; that way, if the logic for retrieving these projects does change, you can make the change in only one place.

As for discovering this info yourself: You can just watch the network traffic (via the browser's development tools) when you navigate to the 'Perspective Session Launcher' on the gateway homepage:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/4/246f06e983b7cd803bdc18b56fc0403d7b6464f3.jpeg)

> [@John\_S1](#):
>
> also do u have something similar like the json format for vision also.??

No. Vision's internals mostly use XML, not JSON.

---

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [June 14, 2022, 3:38am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/10 "2022-06-14T03:38:59Z")

</div>

Thank you for this detailed explanation. Really appreciate you for taking the time and explaining this in detail…

---

<div class="post-metadata">

**Author:** ![Prahil\_S\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Prahil\_S\_Kumar1](https://forum.inductiveautomation.com/u/Prahil_S_Kumar1)\
**Post date:** [June 16, 2022, 8:39am UTC](https://forum.inductiveautomation.com/t/getting-perspective-project-list-from-gateway/60601/11 "2022-06-16T08:39:25Z")

</div>

Thank you for the explanation, I got it. @paul-griffith
