# How to Correctly use json Body in HTTP Binding

**URL:** <https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [June 18, 2022, 1:33am UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917 "2022-06-18T01:33:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [June 18, 2022, 1:33am UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/1 "2022-06-18T01:33:42Z")

</div>

I can’t make the request to work while using http binding. The method for this API is POST and it expects a JSON in the body.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a941bd18cb500d35a99aea71bfd7ea0b425d05ca.png)

But with the binding

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

---

<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:** [June 18, 2022, 4:29pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/2 "2022-06-18T16:29:24Z")

</div>

Looks like an HTTP binding can’t follow a redirect?

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [June 25, 2022, 6:13pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/3 "2022-06-25T18:13:22Z")

</div>

Right, the 301 is saying so. It would be great to have a field to set a maximum redirect number or the chance to edit the manifest.json.

I think the is not solution for this one haha, hello system.net.httpClient

---

<div class="post-metadata">

**Author:** ![Thomas\_Salisbury](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/thomas_salisbury/32/62046_2.png) [@Thomas\_Salisbury](https://forum.inductiveautomation.com/u/Thomas_Salisbury)\
**Post date:** [March 16, 2023, 6:49pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/4 "2023-03-16T18:49:44Z")

</div>

has there not been a solution for this problem?

---

<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:** [March 16, 2023, 6:53pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/5 "2023-03-16T18:53:23Z")

</div>

Have you heard the phrase "red-headed stepchild" ? HTTP Bindings fit the stereotype. The solution is to use `system.net.httpClient()` in a script.

{ To clarify: I'm not a fan of HTTP bindings **at all**. }

---

<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:** [March 16, 2023, 6:54pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/6 "2023-03-16T18:54:18Z")

</div>

Phil's suggestion aside, it doesn't look like any IA staff ever saw or responded to this and presumably no support ticket was ever opened, because I can't find any corresponding issue.

---

<div class="post-metadata">

**Author:** ![Thomas\_Salisbury](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/thomas_salisbury/32/62046_2.png) [@Thomas\_Salisbury](https://forum.inductiveautomation.com/u/Thomas_Salisbury)\
**Post date:** [March 16, 2023, 6:56pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/7 "2023-03-16T18:56:13Z")

</div>

I seem to be getting the same type errors with the httpClient as there doens't seem to be a way to send a "body" with the POST command. So circle of failure?

---

<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:** [March 16, 2023, 6:57pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/8 "2023-03-16T18:57:58Z")

</div>

Why don't you start a new thread with the code you're using. You can certainly POST data with `system.net.httpClient`.

---

<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:** [March 16, 2023, 7:00pm UTC](https://forum.inductiveautomation.com/t/how-to-correctly-use-json-body-in-http-binding/60917/9 "2023-03-16T19:00:50Z")

</div>

> [@Kevin.Herron](#):
>
> You can certainly POST data with `system.net.httpClient`.

Do note in the docs that **all** of the **methods** take one or more keyworded arguments, among which are various options for sending a body.
