# httpPost to httpClient

**URL:** <https://forum.inductiveautomation.com/t/httppost-to-httpclient/111340>\
**Category:** Ignition\
**Created:** [October 10, 2025, 8:34am UTC](https://forum.inductiveautomation.com/t/httppost-to-httpclient/111340 "2025-10-10T08:34:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennifer.ang](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jennifer.ang](https://forum.inductiveautomation.com/u/jennifer.ang)\
**Post date:** [October 10, 2025, 8:34am UTC](https://forum.inductiveautomation.com/t/httppost-to-httpclient/111340/1 "2025-10-10T08:34:11Z")

</div>

Hi,

I am trying to convert from system.net.httpPost to system.net.httpClient. Can anyone help me?

Original:

```python
system.net.httpPost(postUrl,"application/json","{\"value1\":\"" + str(value1) + "\"}")

```

Change to:

```python
postResult = clientPost.post(postUrl,'application/json',{"machine_number":"string"})

```

Error:

{"detail":[{"type":"missing","loc":["body"],"msg":"Field required","input":null}]}

Thank you.

---

<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:** [October 10, 2025, 10:37am UTC](https://forum.inductiveautomation.com/t/httppost-to-httpclient/111340/2 "2025-10-10T10:37:47Z")

</div>

Use explicit parameter names:  
`data={your payload}`

---

<div class="post-metadata">

**Author:** ![Clancy\_Cavanaugh](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@Clancy\_Cavanaugh](https://forum.inductiveautomation.com/u/Clancy_Cavanaugh)\
**Post date:** [October 10, 2025, 4:10pm UTC](https://forum.inductiveautomation.com/t/httppost-to-httpclient/111340/3 "2025-10-10T16:10:03Z")

</div>

What pascal said. For your example I believe it should be:

```python
postResult = clientPost.post(url=postUrl,
                             headers={'Content-Type':'application/json'},
                             data={"machine_number":"string"}
                             )

```

---

<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:** [October 10, 2025, 4:37pm UTC](https://forum.inductiveautomation.com/t/httppost-to-httpclient/111340/4 "2025-10-10T16:37:22Z")

</div>

Note that setting a `Content-Type: application/json` header is not required if you're passing a dictionary to `data` - it'll automatically be sent with a JSON content type.
