# Web API Scripting Help

**URL:** <https://forum.inductiveautomation.com/t/web-api-scripting-help/41566>\
**Category:** Ignition\
**Tags:** vision, ignition80\
**Created:** [December 16, 2020, 3:10pm UTC](https://forum.inductiveautomation.com/t/web-api-scripting-help/41566 "2020-12-16T15:10:09Z")\
**Posts on this page:** 1\
**Showing post:** 10

<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:** [December 17, 2020, 6:04pm UTC](https://forum.inductiveautomation.com/t/web-api-scripting-help/41566/10 "2020-12-17T18:04:26Z")

</div>

Basic authentication is one (somewhat outdated) style of authentication. Most external services won't actually support it. Commonly, web APIs will allow users to generate some kind of long-lived token, and then require that token be passed in an authentication header - with `httpClient`, that would look something like this:

```auto
client = system.net.httpClient()

headers = {
	"Authorization": "Bearer %s" % token
}

response = client.post("url", headers=headers)

```

Or for a more complete example of wrapping a web API:

> [@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/web-api-scripting-help/41566)._
