# How to use the web dev module to send a POST to LINE API?

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-the-web-dev-module-to-send-a-post-to-line-api/80705>\
**Category:** General Discussion\
**Tags:** scripting\
**Created:** [October 19, 2023, 4:04pm UTC](https://forum.inductiveautomation.com/t/how-to-use-the-web-dev-module-to-send-a-post-to-line-api/80705 "2023-10-19T16:04:02Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [October 19, 2023, 4:04pm UTC](https://forum.inductiveautomation.com/t/how-to-use-the-web-dev-module-to-send-a-post-to-line-api/80705/1 "2023-10-19T16:04:02Z")

</div>

I have an Ignition client that wants to send messages to LINE, a freeware app for instant communications on electronic devices. LINE offers an API that I should be able to interface with from the Ignition web dev module. This is a screenshot from the developers page.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/5/85f240972883b1e687bcbbbe5d01693fdb785835.png)

```auto
curl -v -X POST https://api.line.me/v2/bot/message/push \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {channel access token}' \
-H 'X-Line-Retry-Key: {UUID}' \
-d '{
    "to": "U4af4980629...",
    "messages":[
        {
            "type":"text",
            "text":"Hello, world1"
        },
        {
            "type":"text",
            "text":"Hello, world2"
        }
    ]
}'

```

It seems like I need to setup a bot to deal with incoming messages but **I also need to package the data above into the following function** :

I found this link here.

> [@HTTP GET request scripting](https://forum.inductiveautomation.com/t/http-get-request-scripting/12324):
>
> Hi all, I’m once again pushing my Ignition knowledge limits trying to do HTTP requests via an API for an external website. I have found the resource on Ignition function system.net.httpGet: [https://docs.inductiveautomation.com/display/DOC/system.net.httpGet](https://docs.inductiveautomation.com/display/DOC/system.net.httpGet) And that put me in the right direction, but I’m still not sure how to properly handle the result data. If the server returns an HTTP error status code, how can i extract that and log the appropriate error message? My code so far: [code] …

but I don't see how to put the request body together in the example.

```auto
import system
import urllib2

# Generate URL for API call to read products

url = 'https://api.line.me/v2/bot/message/push'

# Create header with information required by API

urlHeader = {“Content-Type”: “application/json”, “Authorization”: “XXXXX”, “X-Line-Retry-Key”: “XXXXX”}

request = urllib2.Request(url, headers=urlHeader)
contents = urllib2.urlopen(request).read()

data = system.util.jsonDecode(contents)
```

It seems like I should be able to use httpPost but I am not sure how to package the required information into the function.  
[https://docs.inductiveautomation.com/display/DOC81/system.net.httpPost](https://docs.inductiveautomation.com/display/DOC81/system.net.httpPost)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/c/fc8e32e45e1286678ef15c76a080c30703cc4cc6.png)

Any input on this issue is appreciated.

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-use-the-web-dev-module-to-send-a-post-to-line-api/80705)._
