# 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:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![beckya](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@beckya](https://forum.inductiveautomation.com/u/beckya)\
**Post date:** [March 23, 2021, 7:53pm UTC](https://forum.inductiveautomation.com/t/how-to-use-httpget-and-httppost-for-api/44817/1 "2021-03-23T19:53:21Z")

</div>

I want to make a connection to a device that requires an API connection. I was informed that in order to connect to Ignition I would need to make a custom API with the httpPost and httpGet methods. The end goal is to chart the temperature from the device in Ignition. Can someone give me some more guidance on how to do that specifically? I have the instructions from the support team on how to create the API and just need to know how to integrate it with Igniton. See link: [https://airqualityegg.wickeddevice.com/api-docs/](https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fairqualityegg.wickeddevice.com%2fapi-docs%2f&c=E,1,pCMk1jiN9NjncgY3zNLlCbFtXfN0pegJFL4kzG9gT934OqkxKI36E1Ar9OL2DGdwcdbQChnryIXBvmtaqPDpnYN6BcD6hSh7AxbGh5xbcRMyPlELm9znThk,&typo=1)

---

<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…
