# HTTP Binding with dynamic Authorization

**URL:** <https://community.openhab.org/t/http-binding-with-dynamic-authorization/85165>\
**Category:** Bindings\
**Created:** [November 9, 2019, 3:43pm UTC](https://community.openhab.org/t/http-binding-with-dynamic-authorization/85165 "2019-11-09T15:43:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![colinfitzpatrick](https://community.openhab.org/user_avatar/community.openhab.org/colinfitzpatrick/32/72699_2.png) [@colinfitzpatrick](https://community.openhab.org/u/colinfitzpatrick)\
**Post date:** [November 9, 2019, 3:43pm UTC](https://community.openhab.org/t/http-binding-with-dynamic-authorization/85165/1 "2019-11-09T15:43:36Z")

</div>

- Platform information:

- Issue of the topic: HTTP Binding

Hi,

I’m trying to configure the HTTP binding to boost my the hot water. I have the API working correctly with POSTMAN. However, I’m having some difficulty setting it up:

My config:

Switch item\_boost\_water “Boost Water” {http=“\>[ON:POST:[https://eu-https.topband-cloud.com/ember-back/zones/boost{Authorization=XXXXXXXX&Accept=application/json}:](https://eu-https.topband-cloud.com/ember-back/zones/boost%7BAuthorization=XXXXXXXX&Accept=application/json%7D:){ “hours”: “1”, “zoneid”: “1234” }] \>[OFF:POST:[https://eu-https.topband-cloud.com/ember-back/zones/boost{Authorization=XXXXXXX&Accept=application/json}:](https://eu-https.topband-cloud.com/ember-back/zones/boost%7BAuthorization=XXXXXXX&Accept=application/json%7D:){ “hours”: “0”, “zoneid”: “1234” }]”}

My two issues are:  
It doesn’t appear to like the JSON post data, do I need to escape or wrap it in some way. I don’t need to parse it, so I’m presuming I don’t need the JSON transformation.

The Authorization expires after an hour. There is a separate request to refresh it. What is the best practice for doing this, and how do I pass it to the command - I couldn’t see how to do that from the documentation.

Apologies if this has been answered elsewhere and I missed it.

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [November 9, 2019, 5:25pm UTC](https://community.openhab.org/t/http-binding-with-dynamic-authorization/85165/2 "2019-11-09T17:25:04Z")

</div>

> [@colinfitzpatrick](#):
>
> The Authorization expires after an hour. There is a separate request to refresh it. What is the best practice for doing this, and how do I pass it to the command - I couldn’t see how to do that from the documentation.

You will need to switch to using Rules and the sendHTTP actions. You can see an example that does something similar in [OAuth2 using just OH Rules and myopenhab.org](https://community.openhab.org/t/oauth2-using-just-oh-rules-and-myopenhab-org/46680).

---

<div class="post-metadata">

**Author:** ![colinfitzpatrick](https://community.openhab.org/user_avatar/community.openhab.org/colinfitzpatrick/32/72699_2.png) [@colinfitzpatrick](https://community.openhab.org/u/colinfitzpatrick)\
**Post date:** [November 10, 2019, 2:24pm UTC](https://community.openhab.org/t/http-binding-with-dynamic-authorization/85165/3 "2019-11-10T14:24:09Z")

</div>

Thank you.

I suspect it’s nearly as much work as creating a binding (which is a guess because I haven’t done either).
