# Perspective session and localhost apis

**URL:** <https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [October 24, 2023, 1:28pm UTC](https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902 "2023-10-24T13:28:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick\_schwartz](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nick\_schwartz](https://forum.inductiveautomation.com/u/nick_schwartz)\
**Post date:** [October 24, 2023, 1:28pm UTC](https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902/1 "2023-10-24T13:28:20Z")

</div>

I'm trying to track down how to (or if possible) to send a fetch to a local API source on the client computer running a Perspective session.

Our integration environment has many local web based APIs that are listening for data to be sent to them.

I have created a view with a button, I added and Event on the onClick action that is a script.

I use httpClient to send to [http://localhost:5000/thisistheapi](http://localhost:5000/thisistheapi).

However this only processes on the GATEWAY and not from the client session. So the API on the client computer doesn't get the message.

It seems like this functionality should exist as there are other Actions that interact with the actual session, Refresh, Navigate, Request Print all execute on the Client session. Does anyone have a way to do a simple web fetch from a client session like this?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 24, 2023, 1:44pm UTC](https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902/2 "2023-10-24T13:44:02Z")

</div>

> [@nick\_schwartz](#):
>
> how to (or if possible) to send a fetch to a local API source on the client computer running a Perspective session.

Generally not possible. Browsers consider such behavior to be a hacker trying to take control of the user's machine. And therefore go to great lengths to block it. (Along with all other local operations for the user's machine.)

If you really need such behavior, you need Vision, not Perspective.

---

<div class="post-metadata">

**Author:** ![nick\_schwartz](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nick\_schwartz](https://forum.inductiveautomation.com/u/nick_schwartz)\
**Post date:** [October 24, 2023, 2:12pm UTC](https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902/3 "2023-10-24T14:12:16Z")

</div>

Thank you for putting it that way, it never felt like how we were going about this was the best way to do it that makes much more sense.

A more in depth question then is can the Serial module be used with Perspective to send serial data over the clients session or is that module just for Vision?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 24, 2023, 2:13pm UTC](https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902/4 "2023-10-24T14:13:25Z")

</div>

Again, just for Vision.

If you use it with Perspective the serial connection needs to be on the Gateway.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 24, 2023, 2:16pm UTC](https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902/5 "2023-10-24T14:16:34Z")

</div>

> [@nick\_schwartz](#):
>
> A more in depth question

> [@pturmel](#):
>
> Along with all other local operations for the user's machine.

So, no. That would be a local operation that browsers don't permit. There's some hope that Perspective Workstation will eventually be able to do serial ports.

---

<div class="post-metadata">

**Author:** ![nick\_schwartz](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nick\_schwartz](https://forum.inductiveautomation.com/u/nick_schwartz)\
**Post date:** [October 24, 2023, 2:22pm UTC](https://forum.inductiveautomation.com/t/perspective-session-and-localhost-apis/80902/6 "2023-10-24T14:22:43Z")

</div>

Thank you all for responding so quickly and clearing up our misconceptions
