# Http response code \_ 422

**URL:** <https://forum.inductiveautomation.com/t/http-response-code-422/75418>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 22, 2023, 7:00pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418 "2023-06-22T19:00:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shlok\_Mundhra](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Shlok\_Mundhra](https://forum.inductiveautomation.com/u/Shlok_Mundhra)\
**Post date:** [June 22, 2023, 7:00pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/1 "2023-06-22T19:00:06Z")

</div>

Error:  
Traceback (most recent call last):  
File "", line 64, in   
File "", line 61, in update\_cloud\_mode  
IOError: Server returned HTTP response code: 422 for URL: [http://10.207.21.46/cloud/mode](http://10.207.21.46/cloud/mode)

code:  
\<data\_final = json.dumps(Data)  
print(type(data\_final))  
print system.net.httpPut(url, data\_final, headerValues = headers)\>  
data\_final is of type

Can someone tell me how to fix this please?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [June 22, 2023, 7:22pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/2 "2023-06-22T19:22:16Z")

</div>

You should get comfortable with server codes - [HTTP response status codes - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)

For 422 -

422 Unprocessable Content  
The request was well-formed but was unable to be followed due to semantic errors.

So seems like for the most part your request is fine but perhaps the data you sent was malformed / not what the server is expecting

---

<div class="post-metadata">

**Author:** ![Shlok\_Mundhra](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Shlok\_Mundhra](https://forum.inductiveautomation.com/u/Shlok_Mundhra)\
**Post date:** [June 22, 2023, 7:23pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/3 "2023-06-22T19:23:51Z")

</div>

Thank you for the response. I do understand the server codes but I have tried to feed it all kinds of data, dictionary and string (which it can possibly accept).

Since it is giving the same error. So i thought of asking it here

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [June 22, 2023, 7:26pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/4 "2023-06-22T19:26:04Z")

</div>

Normally API's should have documentation on what you should be sending them. Do you have a link to that?

---

<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 22, 2023, 8:12pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/5 "2023-06-22T20:12:17Z")

</div>

Also,

- You are using `httpPut()`. That is a legacy function that isn't expected to work with the security on most modern web servers. Learn to use `system.net.httpClient()` for everything.

- Consider using wireshark to see what you are really sending and receiving.

---

<div class="post-metadata">

**Author:** ![Shlok\_Mundhra](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Shlok\_Mundhra](https://forum.inductiveautomation.com/u/Shlok_Mundhra)\
**Post date:** [June 22, 2023, 8:12pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/6 "2023-06-22T20:12:49Z")

</div>

@pturmel Thank you so much sir!

---

<div class="post-metadata">

**Author:** ![Shlok\_Mundhra](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Shlok\_Mundhra](https://forum.inductiveautomation.com/u/Shlok_Mundhra)\
**Post date:** [June 22, 2023, 8:20pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/7 "2023-06-22T20:20:52Z")

</div>

@pturmel Can you please tell me the syntax for `httpClient()` or a place where I can find it for the PUT commands

---

<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 22, 2023, 8:26pm UTC](https://forum.inductiveautomation.com/t/http-response-code-422/75418/8 "2023-06-22T20:26:25Z")

</div>

User manual?

[https://docs.inductiveautomation.com/display/DOC81/system.net.httpClient](https://docs.inductiveautomation.com/display/DOC81/system.net.httpClient)

Lots of examples here on the forum, too.
