[RESOLVED] network.request Invalid Parameter: URL argument was malformed URL / sending a push message

Hi, 

When trying to use network.request I get “Invalid Parameter: URL argument was malformed URL”.  How can I improve that url? https://cp.pushwoosh.com/json/1.3/%method%

Note that the editor here under escapes the % in this url.

I am trying to send a push message to a single device via the Pushwoosh service. I hope this is sort of how it should work, but I can’t test it due to the error :

[lua]

 local pushMessage = { request = {

                        application =“xxx”,

                        auth = “xxxxxxxxxx”,

                        notifications = 

                        {{

                            – Content settings

                            send_date = “now”,        

                            ignore_user_timezone = true,  

                            content = userSettings.nickName…" "…_G.invitationMessageText,

                            platforms = {1},

                            ios_badges = 1,               

                            devices = {message.hwidFriend},

                        }}

                        

                    }

              }

                    

                    

                    local headers = {}

                    

                    headers[“Content-Type”] = “application/x-www-form-urlencoded”

                    headers[“Accept-Language”] = “en-US”

                    

                    local body = json.encode(pushMessage)  

                    

                    local params = {}

                    params.headers = headers

                    params.body = body

                    

                    local url = “https://cp.pushwoosh.com/json/1.3/%method%

                    

                    network.request( url, “POST”, networkListener, params)

[/lua]

http://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/

thx

Hi Jack,

I haven’t used pushwoosh myself, but I noticed it looks like you copied the URL from this page: http://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/.  I think they put %method% in their sample URL as a placeholder, and you’re supported to replace it (without the % signs) with the action you are actually taking, i.e., createMessage or registerDevice.

  • Andrew

Arrrr of course, why didnt I see that :)  thx it now works fine.

[lua]local url = “https://cp.pushwoosh.com/json/1.3/createMessage”[/lua]

Hi Jack,

I haven’t used pushwoosh myself, but I noticed it looks like you copied the URL from this page: http://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/.  I think they put %method% in their sample URL as a placeholder, and you’re supported to replace it (without the % signs) with the action you are actually taking, i.e., createMessage or registerDevice.

  • Andrew

Arrrr of course, why didnt I see that :)  thx it now works fine.

[lua]local url = “https://cp.pushwoosh.com/json/1.3/createMessage”[/lua]