# HTTP get - send body text

**URL:** <https://forum.inductiveautomation.com/t/http-get-send-body-text/43118>\
**Category:** Ignition\
**Created:** [February 8, 2021, 2:23am UTC](https://forum.inductiveautomation.com/t/http-get-send-body-text/43118 "2021-02-08T02:23:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eichler-eng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eichler-eng/32/21259_2.png) [@eichler-eng](https://forum.inductiveautomation.com/u/eichler-eng)\
**Post date:** [February 8, 2021, 2:23am UTC](https://forum.inductiveautomation.com/t/http-get-send-body-text/43118/1 "2021-02-08T02:23:30Z")

</div>

Hi All

I've written a short script that pulls data from a web server. This works fine but I would like to send some arguments in the body of the HTTP command so that I can filter the results.

The documentation from the web server:

> Body - Array of tag names. When not set returns the value of all tags in the scene.  
> e.g.  
> [  
> "name0",  
> "name1"  
> ]
> 
> EXAMPLE REQUEST
> 
> GET /api/tag/values/by-name  
> Content-Type: application/json
> 
> [  
> "At left entry",  
> "Left conveyor",  
> "Name of non-existing tag",  
> "Left count",  
> "Weight"  
> ]

My current script returns the data for all tags and is as follows:

```auto
#The command - see manual. Note, remove "GET"
command = "/api/tag/values/by-name"
#Build the url
url = "http://192.168.10.96:7410%s" %(command)
#Send the command
response = system.net.httpGet(url)
#Decode the response
respjson = system.util.jsonDecode(response)
#Print the response on the screen. This is an array of dict.
print respjson
#Print the first array element.
print respjson[0]

```

Please can someone help me to include the tag names as arguments? The manual seems to say that I need to add these in the form of a dictionary. I have tried this but all attempts have failed.

[https://docs.inductiveautomation.com/display/DOC80/system.net.httpGet](https://docs.inductiveautomation.com/display/DOC80/system.net.httpGet)

Best regards.

---

<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:** [February 8, 2021, 5:50pm UTC](https://forum.inductiveautomation.com/t/http-get-send-body-text/43118/2 "2021-02-08T17:50:14Z")

</div>

GET requests, by definition, do not have a body - you can only pass parameters via URL parameters.  
It’s a short snippet of manual, but I’m guessing you call `/api/tag/values/by-name` with GET and get a list of all possible values - and then you can likely `PUT`, `PATCH`, or `POST` new values into that list.

As an aside, for all 8.0+ HTTP interactions I highly recommend switching to `system.net.httpClient()`. It’s faster, more ergonomic to use from scripting, and has a bunch of builtin features that aren’t possible via `system.net.httpGet/Post/etc`. For instance, your call to httpGet followed by jsonDecode can be handled in one line:  
`response = system.net.httpClient().get(url).json`  
And if you instantiate the httpClient() separately and reuse it, you can take advantage of HTTP connection pooling automatically.

---

<div class="post-metadata">

**Author:** ![eichler-eng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eichler-eng/32/21259_2.png) [@eichler-eng](https://forum.inductiveautomation.com/u/eichler-eng)\
**Post date:** [February 21, 2021, 9:46am UTC](https://forum.inductiveautomation.com/t/http-get-send-body-text/43118/3 "2021-02-21T09:46:34Z")

</div>

Thanks and sorry for the slow reply. I used system.net.httpClient() with great results. After spending ages importing third party libraries, this is great. For anyone who is interested, my new code is as follows. This allows me to send a header and parameters. I can use it to read and write data. Thanks again.

```auto
#The command - see manual. Note, remove "GET"
command = "/api/tag/values/by-name"
#Build the url
url = "http://192.168.10.96:7410%s" %(command)
#Declare a client
client = system.net.httpClient()
#Send the request	
response = client.put(url, {'Content-Type': 'application/json',}, '[{"name":"Run","value":true}]')
#Print the response
print response.json

```
