# HTTP Binding vs Script

**URL:** <https://forum.inductiveautomation.com/t/http-binding-vs-script/95819>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [September 10, 2024, 9:06pm UTC](https://forum.inductiveautomation.com/t/http-binding-vs-script/95819 "2024-09-10T21:06:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacob\_Leonard](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@Jacob\_Leonard](https://forum.inductiveautomation.com/u/Jacob_Leonard)\
**Post date:** [September 10, 2024, 9:06pm UTC](https://forum.inductiveautomation.com/t/http-binding-vs-script/95819/1 "2024-09-10T21:06:42Z")

</div>

I am trying to move to HTTP binding vs just running my API queries in a script.

I have a script:

 ![CaptureScript](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/c/1c5afc7de991cef466ccd64e646a81f1e15df345.jpeg)  
and as you can see, it is a success and returns data. But, I can't seem to get my HTTP binding to give me the same results.  
 ![CaptureBinding](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/6/a6bd7e9201a4a43a4bc57efe684e73bf3fede48f.jpeg)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c72f63281ae605ef83e762fc9c745ee74f42be84.png)

I know the API works from the script, but I can't seem to get the bindings to work. Also, there is no API documentation to look up.

I know its something real simple, but I cant seem to figure it out.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [September 10, 2024, 9:54pm UTC](https://forum.inductiveautomation.com/t/http-binding-vs-script/95819/2 "2024-09-10T21:54:40Z")

</div>

I'm not certain, but I believe you'll need to do something to return a JSON encoded string as I suspect passing `{view.custom.params}` is passing an object rather than a string. I just don't know what function you could use to convert it without passing it to a script.

---

<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:** [September 10, 2024, 9:59pm UTC](https://forum.inductiveautomation.com/t/http-binding-vs-script/95819/3 "2024-09-10T21:59:06Z")

</div>

The body passing should be fine, actually. The more pressing issue is that I don't see any attempt to recreate the authentication headers, which is the HTTP binding's biggest flaw - you can't really use it for stateful authentication flows, only basic static login e.g. bearer tokens (where you don't mind each session issuing potentially overlapping requests).

I would recommend continuing to use scripting, but migrating to `system.net.httpClient` over `httpPost`, over the HTTP binding.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [September 11, 2024, 6:46am UTC](https://forum.inductiveautomation.com/t/http-binding-vs-script/95819/4 "2024-09-11T06:46:25Z")

</div>

do not put passwords in perspective properties, i hope this is for demo only D:

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 11, 2024, 7:00am UTC](https://forum.inductiveautomation.com/t/http-binding-vs-script/95819/5 "2024-09-11T07:00:00Z")

</div>

It might be fine if the property is set to private.  
That's one feature I have yet to dig in, so I'm not sure what exactly happens when you change that setting and what it entails, but from what I understand properties set to private never leave the gateway.

Not that you should store password there, clearly, but it might not be _that bad_
