# Post XML to website using Homeyscript

**URL:** <https://community.homey.app/t/post-xml-to-website-using-homeyscript/57254>\
**Category:** Questions & Help\
**Tags:** homeyscript\
**Created:** [December 26, 2021, 9:06pm UTC](https://community.homey.app/t/post-xml-to-website-using-homeyscript/57254 "2021-12-26T21:06:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [December 26, 2021, 10:27pm UTC](https://community.homey.app/t/post-xml-to-website-using-homeyscript/57254/2 "2021-12-26T22:27:34Z")

</div>

Maybe this script gets you some ideas:

> [@HTTP Request Flow with username/password](https://community.homey.app/t/http-request-flow-with-username-password/51210/3):
>
> var token\_ // variable will store the token  
> var userName = “clientID”; // app clientID  
> var passWord = “secretKey”; // app clientSecret  
> var caspioTokenUrl = “[https://xxx123.caspio.com/oauth/token”](https://xxx123.caspio.com/oauth/token%E2%80%9D); // Your application token endpoint  
> var request = new XMLHttpRequest();
> 
> function getToken(url, clientID, clientSecret) {  
> var key;  
> request.open(“POST”, url, true);  
> request.setRequestHeader(“Content-type”, “application/json”);  
> request.send(“grant\_type=client\_credentials&client\_id=”+clientID+“&”+“client\_secret=”+clientSecret); // specify the credentials to receive the token on request  
> request.onreadystatechange = function () {  
> if (request.readyState == request.DONE) {  
> var response = request.responseText;  
> var obj = JSON.parse(response);  
> key = obj.access\_token; //store the value of the accesstoken  
> token\_ = key; // store token in your global variable “token\_” or you could simply return the value of the access token from the function  
> }  
> }  
> }  
> // Get the token  
> getToken(caspioTokenUrl, userName, passWordz);

Not script, but it might come in handy:  
just a few ideas using flow cards

> [@POST HTTP request not working](https://community.homey.app/t/post-http-request-not-working/21464/6):
>
> Thx all for your help. I found a different command which works. I am using the „logic web request“ command instead of http request. Code structure is same as used in iOS Shortcuts. See screenshot below.

> [@POST HTTP request not working](https://community.homey.app/t/post-http-request-not-working/21464/10):
>
> Then i am to late to help you, but anyway here how is working with the http app from Erik: [image]

---

_[View the full topic](https://community.homey.app/t/post-xml-to-website-using-homeyscript/57254)._
