# How to use GEt and POST methods?

**URL:** <https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770>\
**Category:** Ask for Help\
**Created:** [November 19, 2021, 12:15pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770 "2021-11-19T12:15:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evgeny\_Balandin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evgeny_balandin/32/21923_2.png) [@Evgeny\_Balandin](https://community.glideapps.com/u/Evgeny_Balandin)\
**Post date:** [November 19, 2021, 12:15pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770/1 "2021-11-19T12:15:02Z")

</div>

Hi guys!  
I’ve searched this theme but didn’t find yet any documentation and I’m new in glide.  
Could you please tell me how I could use Post method to send commands on my remote device?  
I need to add a few variables on the basic level of the app and embed pretty simple scripts inside the buttons to POST commands.

Thank you for any support in advance!

```auto
<html>
<head>
</head>
<body>
<p>
<button type="submit" id="submit1">- 1 -</button>
<button type="submit" id="submit2">- 2 -</button>
<button type="submit" id="submit3">- 3 -</button>
<button type="submit" id="submit4">- 4 -</button>
</p>
<p>
<button type="submit" id="submit5">- 5 -</button>
<button type="submit" id="submit6">- 6 -</button>
<button type="submit" id="submit7">- 7 -</button>
<button type="submit" id="submit8">- 8 -</button>
<button type="submit" id="submit9">- 9 -</button>
</p>
<p>
<button type="submit" id="submit10">- 10 -</button>
<button type="submit" id="submit11">- 11 -</button>
<button type="submit" id="submit12">- 12 -</button>
<button type="submit" id="submit13">- 13 -</button>
<button type="submit" id="submit14">- 14 -</button>
</p>
<script>
var prefix='#>';
var suffix='$\n';
var sim='http://11.111.111.11:1111';
document.querySelector("#submit1").onclick = function(){let response = fetch(sim, {method: 'POST',body: prefix+'01'+suffix});}
document.querySelector("#submit2").onclick = function(){let response = fetch(sim, {method: 'POST',body: prefix+'02'+suffix});}
document.querySelector("#submit3").onclick = function(){let response = fetch(sim, {method: 'POST',body: prefix+'03'+suffix});}
document.querySelector("#submit4").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'04'+suffix
      });
}
document.querySelector("#submit5").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'05'+suffix
      });
}
document.querySelector("#submit6").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'06'+suffix
      });
}
document.querySelector("#submit7").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'07'+suffix
      });
}
document.querySelector("#submit8").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'08'+suffix
      });
}
document.querySelector("#submit9").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'09'+suffix
      });
}
document.querySelector("#submit10").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'10'+suffix
      });
}
document.querySelector("#submit11").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'11'+suffix
      });
}
document.querySelector("#submit12").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'12'+suffix
      });
}
document.querySelector("#submit13").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'13'+suffix
      });
}
document.querySelector("#submit14").onclick = function(){
let response = fetch(sim, {
        method: 'POST',
        body: prefix+'14'+suffix
      });
}
</script>
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [November 19, 2021, 12:18pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770/2 "2021-11-19T12:18:39Z")

</div>

Can you describe more about your use case? I don’t think this is a common case for Glide. It looks like you’re trying to insert some HTML code with functions to do something when a button is clicked from a “remote” UI?

---

<div class="post-metadata">

**Author:** ![Evgeny\_Balandin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evgeny_balandin/32/21923_2.png) [@Evgeny\_Balandin](https://community.glideapps.com/u/Evgeny_Balandin)\
**Post date:** [November 19, 2021, 12:36pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770/3 "2021-11-19T12:36:47Z")

</div>

Almost as you described. I want to insert HTML code to send a command on a button click event, but send a command outside of glide.

To add the details. I have a device made on the Arduino platform. It has a GSM module with a sim card(allows to receive commands via EDGE). Attached HTML code is an HTML page with 14 buttons. When you click the button, you send the command to the Arduino device so the platform activate the appropriate function. like in a smart house.

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [November 19, 2021, 12:57pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770/4 "2021-11-19T12:57:55Z")

</div>

POST and GET can be achieved (broadly) using the new FETCH column

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [November 19, 2021, 1:24pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770/5 "2021-11-19T13:24:42Z")

</div>

Would it work if we mimic a “remote” UI in Glide, then each of them sends a webhook to Evgeny’s device?

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [November 19, 2021, 2:04pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770/6 "2021-11-19T14:04:33Z")

</div>

It’s tricky to understand, but I thought that the requirement was to call an API and potentially get a return value. The API call seems to hit a remote device, instructing it to do something. If so then I think the FETCH might do the job. Not sure.

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [November 19, 2021, 2:35pm UTC](https://community.glideapps.com/t/how-to-use-get-and-post-methods/34770/7 "2021-11-19T14:35:13Z")

</div>

Hola!

I think you need something like what I did here:  
1- [Glide with IoT, IIoT (Industrial IoT) and Domotic applications](https://community.glideapps.com/t/glide-with-iot-iiot-industrial-iot-and-domotic-applications/22698)  
2- [A real notification using Glide and IoT](https://community.glideapps.com/t/a-real-notification-using-glide-and-iot/24163)

Take a look at it and let me know if this helps you.

Saludos!
