# Feedback after using POST service

**URL:** <https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [April 9, 2020, 7:27am UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814 "2020-04-09T07:27:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kairongsen](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@kairongsen](https://forum.inductiveautomation.com/u/kairongsen)\
**Post date:** [April 9, 2020, 7:27am UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/1 "2020-04-09T07:27:59Z")

</div>

Greetings.

Is there any way to verify the HTTP POST action being carried out?

url = “[http://some-api-url.com/api](http://some-api-url.com/api)”  
file = “path/to/some/file”  
system.net.httpClient().postAsync(url, file=file)

For example, right after the above scripting being executed, is there any way to receive the feedback (like the command being executed)?

---

<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:** [April 9, 2020, 11:53am UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/2 "2020-04-09T11:53:09Z")

</div>

`postAsync` returns a Promise object which you can add a callback to. See [https://docs.inductiveautomation.com/display/DOC80/system.net.httpClient](https://docs.inductiveautomation.com/display/DOC80/system.net.httpClient)

If you want to use the result immediately you should probably just use the blocking variant (`post`).

---

<div class="post-metadata">

**Author:** ![nicholas.robinson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nicholas.robinson/32/22188_2.png) [@nicholas.robinson](https://forum.inductiveautomation.com/u/nicholas.robinson)\
**Post date:** [April 9, 2020, 12:37pm UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/3 "2020-04-09T12:37:07Z")

</div>

Using the normal post method like below, is there a way to get the HTTP response code from the reply?

page = system.net.httpPost(url, {‘x-aio-key’: aioKey, ‘value’:value})

for example when using python requets, “page.status\_code” would give you the HTTP code.

Thanks,

Nick

---

<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:** [April 9, 2020, 12:38pm UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/4 "2020-04-09T12:38:25Z")

</div>

Unfortunately no. Shortcomings like this are one of the things the new `system.net.httpClient` API fixes.

---

<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:** [April 9, 2020, 1:18pm UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/5 "2020-04-09T13:18:44Z")

</div>

Going back to the classic system.net.httpPost() function is _ **not** _ what Kevin was suggesting. Use the .post() method of httpClient–its response object has a .statusCode property.

{ As documented in the link Kevin provided. }

---

<div class="post-metadata">

**Author:** ![nicholas.robinson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nicholas.robinson/32/22188_2.png) [@nicholas.robinson](https://forum.inductiveautomation.com/u/nicholas.robinson)\
**Post date:** [April 9, 2020, 3:24pm UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/6 "2020-04-09T15:24:22Z")

</div>

@pturmel @Kevin.Herron

Thanks for your advice, it works brilliantly! I just put a quick example snapshot up in case it can be a helpful reference for anyone else.

 ![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b8a714eae07a9fcba2048ff101677c08ac345c22.png)

---

<div class="post-metadata">

**Author:** ![kairongsen](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@kairongsen](https://forum.inductiveautomation.com/u/kairongsen)\
**Post date:** [April 15, 2020, 7:01am UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/7 "2020-04-15T07:01:06Z")

</div>

@Kevin.Herron @nicholas.robinson @pturmel

Thanks for the reply!!! I was away from my laptop for a few days didn’t expect the suggestion to come out so fast. Let me look into this now. Thanks all. Have a nice day and take care.

---

<div class="post-metadata">

**Author:** ![kairongsen](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@kairongsen](https://forum.inductiveautomation.com/u/kairongsen)\
**Post date:** [November 3, 2020, 9:29am UTC](https://forum.inductiveautomation.com/t/feedback-after-using-post-service/33814/8 "2020-11-03T09:29:43Z")

</div>

Hi all, I manage to solve this matter after email to the support team and try it on myself. Attached below is the solution:

Inductive Automation has a knowledge base article on how to you can import python modules.  
[https://support.inductiveautomation.com/index.php?/Knowledgebase/Article/View/98/2/importing-and-using-3rd-party-python-libraries-in-ignition#:~:text=To%20import%20the%20library%20into,located%20inside%20the%20installation%20directory.&text=Now%20you%20are%20ready%20to,of%20your%20newly%20imported%20library](https://support.inductiveautomation.com/index.php?/Knowledgebase/Article/View/98/2/importing-and-using-3rd-party-python-libraries-in-ignition#:~:text=To%20import%20the%20library%20into,located%20inside%20the%20installation%20directory.&text=Now%20you%20are%20ready%20to,of%20your%20newly%20imported%20library)!

You can download the official python 2.7 version of the requests module from this website: [https://pypi.org/project/requests/#files](https://pypi.org/project/requests/#files)

You would need to transfer over the “requests”, “idna”, “certifi”, “chardet”, and “urllib3” folders to the “mylib” Ignition folder to use the requests module.

Once this is completed, you’ll be able to use the python requests module to use the post() method within your scripts and the script console of the Designer.

Below is the script to do so

import requests

headers = {  
‘x-api-key’: ’ ',  
‘Content-Type’: ‘application/json’,  
}

data = ‘{“Destination”: " ", “Message”: " ", “Priority”: }’

response = requests.post(‘URL’, headers=headers, data=data, verify=False, auth=(‘username’, ‘password’))

print(response.status\_code)
