# Converting httpGet to httpClient

**URL:** <https://forum.inductiveautomation.com/t/converting-httpget-to-httpclient/68072>\
**Category:** Maker\
**Tags:** perspective\
**Created:** [December 29, 2022, 5:51pm UTC](https://forum.inductiveautomation.com/t/converting-httpget-to-httpclient/68072 "2022-12-29T17:51:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 29, 2022, 5:51pm UTC](https://forum.inductiveautomation.com/t/converting-httpget-to-httpclient/68072/1 "2022-12-29T17:51:31Z")

</div>

I'm not sure what I'm missing here while trying to convert my old `httpGet()` requests to the new `httpClient()`.

Old Version

```python
header = {'Content-Type': 'text/json','Authorization':'Bearer %s' % accessToken} 
body = '{"selection":{"selectionType":"registered","selectionMatch":"","includeRuntime":true}}' #"includeAlerts":true

url = 'https://api.ecobee.com/1/thermostat?format=json&body=%s' % body
response = system.net.httpGet(url, headerValues=header)
json = system.util.jsonDecode(response)	

```

Attempted new version

```python
headers = {"Content-Type": "text/json","Authorization":"Bearer %s" % accessToken} 
params = {"selection":{"selectionType":"registered","selectionMatch":"","includeRuntime":True}} #"includeAlerts":true

url = 'https://api.ecobee.com/1/thermostat?format=json&body='
response = http.client.get(url, params = params, headers=headers)
json = response.getText()
print json

```

response

```auto
{
  "status": {
    "code": 4,
    "message": "Serialization error. Malformed json. Check your request and parameters are valid."
  }
}

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 29, 2022, 6:05pm UTC](https://forum.inductiveautomation.com/t/converting-httpget-to-httpclient/68072/2 "2022-12-29T18:05:03Z")

</div>

I fixed it, I should have taken out the `&` between format and body and added to the dictionary and not the url. This fixed it 🙂

```auto
params = {"format":"json","body":{"selection":{"selectionType":"registered","selectionMatch":"","includeRuntime":"true"}}} #"includeAlerts":true

url = 'https://api.ecobee.com/1/thermostat'

```
