# Help with POST request with Venstar API

**URL:** <https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347>\
**Category:** General\
**Created:** [27 May 2021 14:34 UTC](https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347 "2021-05-27T14:34:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![NRdiscrs9393](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nrdiscrs9393/32/726_2.png) [@NRdiscrs9393](https://discourse.nodered.org/u/NRdiscrs9393)\
**Post date:** [28 May 2021 18:15 UTC](https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347/2 "2021-05-28T18:15:00Z")

</div>

SOLVED!!

After some digging on github along with some other forums, I found an API guide (attached). Mode, fan, heattemp, cooltemp must always be posted together. Additionally pin if passcode is set. Command is submitted via an HTTP POST and is URL encoded instead of JSON.

Here’s the function for Control

```auto
var mode=flow.get('TmodeUpstairs');
var fan=flow.get('FmodeUpstairs');
var heat=flow.get('THeatUpstairs');
var cool=flow.get('TCoolUpstairs');

msg.headers={ 
    'Content-Type': 'application/x-www-form-urlencoded'
};
//msg.payload = {};
msg.payload={ 
'mode':mode,
'fan':fan,
'heattemp':heat,
'cooltemp':cool
};
return msg;

```

Here’s the API Guide.  
[vennstar-api.pdf](https://discourse.nodered.org/uploads/short-url/fM9rkaS81F122kicWprLcNHFacQ.pdf) (76.2 KB)

Here's an integration guide along with the flow.

> [@Get the most of your Venstar Thermostat with this Node Red flow and MQTT](https://discourse.nodered.org/t/get-the-most-of-your-venstar-thermostat-with-this-node-red-flow-and-mqtt/46417):
>
> Here's the Flow [T3700.txt](https://discourse.nodered.org/uploads/short-url/al7n7URpauamGzp2MdO0dzRjOQB.txt) (69.5 KB) Here's what I did. There are multiple ways to achieve this. While in OpenHAB Paper UI, create a new "Generic MQTT Thing" named HVAC. Then create a "Number" Channel with MQTT state topic set to "HVAC/Upstairs/Temp" and MQTT command topic set to "HVAC/Upstairs/SetTemp". Repeat for whatever else you want to add to OH. Notes: I use a flow named "Injection Master" that handles all my communications in and out of Node Red. i.e. MQTT, email, and other APIs. The…

---

_[View the full topic](https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347)._
