# How to use httpGet and httpPost for API

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-httpget-and-httppost-for-api/44817>\
**Category:** Ignition\
**Created:** [March 23, 2021, 7:53pm UTC](https://forum.inductiveautomation.com/t/how-to-use-httpget-and-httppost-for-api/44817 "2021-03-23T19:53:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [March 23, 2021, 8:10pm UTC](https://forum.inductiveautomation.com/t/how-to-use-httpget-and-httppost-for-api/44817/2 "2021-03-23T20:10:28Z")

</div>

Take a look at `system.net.httpClient()`:

> [@Ignition and (Docker) Portainer API. (HTTP queries)](http://forum.inductiveautomation.com/t/ignition-and-docker-portainer-api-http-queries/36725/2):
>
> Http bindings aren’t going to work well for this purpose - they’re not very good at authentication right now. I’d recommend [system.net.httpClient()](https://docs.inductiveautomation.com/display/DOC80/system.net.httpClient). You could wrap things in a class to make accessing the API a little friendlier: class PortainerClient(object): def \_\_init\_\_(self, baseUrl, username, password, \*\*kwargs): self.baseUrl = baseUrl self.client = system.net.httpClient(\*\*kwargs) response = self.client.post(baseUrl + "auth", data={"Username": username, "Password": password}) self…

> [@Importing python library - the wrong way?](http://forum.inductiveautomation.com/t/importing-python-library-the-wrong-way/40527/5):
>
> The last commit in the Python registry you linked is titled ‘drop Python 2 support’, so you might not have much luck. But, really, it looks like the API is pretty simple to wrap. Try this out: class AmbientWeatherClient(object): def \_\_init\_\_(self, applicationKey, apiKey): self.baseUrl = "https://api.ambientweather.net/v1/" self.authorization = { "applicationKey": applicationKey, "apiKey": apiKey } self.client = system.net.httpClient() def call(self, endpoint, \*\*kwargs): k…

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-use-httpget-and-httppost-for-api/44817)._
