Http POST request with variables

Greetings,

I use Boxcar in iOS for my personal push notifications and would like to somehow integrate it with Vera. I haven’t found a plugin who allows it but i would like to test it using LUUP for now and maybe develop a plugin on my own.

For now i need to be able to send a POST request with parameters.

by searching i have:

[code] local http = require(“socket.http”)

– 5 Second timeout
http.TIMEOUT = 5

– The return parameters are in a different order from luup.inet.wget(…)
result, status = http.request(“http://192.168.0.113/runprocess.htm”, “run=run”)[/code]

but i would like to now if there is a way to pass variables as a parameter into http.request.

More info here.

thanks

It sounds like you are trying to call back to your Vera from your mobile.

If so this is very complicated on UI7 remotely.

Search the forum for “my notes remote access”
The topic is labeled UI6,but is applicable to UI7.

[quote=“RichardTSchaefer, post:2, topic:184106”]It sounds like you are trying to call back to your Vera from your mobile.

If so this is very complicated on UI7 remotely.

Search the forum for “my notes remote access”
The topic is labeled UI6,but is applicable to UI7.[/quote]

Thank you for your reply RichardTSchaefer . I’m not trying to do such thing - although i understand that my poor example lead you to think so.

I need to do a POST request to https://new.boxcar.io/api/notifications with the following variables:

    user_credentials: This is where you pass your access token. Your access token can be found in Boxcar global setting pane. It is a string composed of letters and numbers. Do not confuse it with your Boxcar email address.
    notification[title]: This parameter will contain the content of the alert and the title of the notification in Boxcar. Max size is 255 chars.
    notification[long_message]: This is where you place the content of the notification itself. It can be either text or HTML. Max size is 4kb.
    notification[sound] (optional):This is were you define the sound you want to play on your device. As a default, the general sound is used, if you omit this parameter. General sound typically default to silent, but if you changed it, you can force the notification to be silent with the "no-sound" sound name.
    notification[source_name] (optional): This is a short source name to show in inbox. Default is "Custom notification".
    notification[icon_url] (optional): This is where you define the icon you want to be displayed within the application inbox.
    notification[open_url] (optional): If defined, Boxcar will redirect you to this url when you open the notification from the Notification Center. It can be a http link like http://maps.google.com/maps?q=cupertino or an inapp link like twitter:///user?screen_name=vutheara

so a more accurate example would be:

[code] local http = require(“socket.http”)

– 5 Second timeout
http.TIMEOUT = 5

– The return parameters are in a different order from luup.inet.wget(…)
result, status = http.request(“https://new.boxcar.io/api/notifications”)[/code]

but now i’m missing my variables…

See:

Also: socket.http doesn’t (by itself) do HTTPS. There’s an extra library to do that. I forget its name but i think it has “ssl” in it.

Edit: I knew this had been talked about before on the forum. Look here: http://forum.micasaverde.com/index.php?topic=11043.0

thank you both for such a fantastic help!

i guess my google mojo is down as i did a very thorough search before posting.

code available here.

Now to google how to upload the function in a single file and to import it when need instead of copy+pasting everything every time…