Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
balbant
Streaming Star

How can pass roAssociativeArray in URL parameters?

Hi,
Can we request URL with roAssociativeArray parameters? as below :-

GetFunction(http://mydomain.com/webservices/webservices.php?route=option&custom_option=[{"option_id" : "7", "option_value" : 24}, {"option_id" : "8", "option_value" : 27}])


or
options = [{"option_id" : "7", "option_value" : 24}, {"option_id" : "8", "option_value" : 27}]

GetFunction("http://mydomain.com/webservices/webservices.php?route=option&custom_option"+options)


I have requested above URLs but I am getting error, my code is-
function GetFunction(url)
        request = CreateObject("roUrlTransfer")
        request.SetCertificatesFile("common:/certs/ca-bundle.crt")
        request.AddHeader("X-Roku-Reserved-Dev-Id", "")
        request.InitClientCertificates()
        request.enablehostverification(false)
        request.enablepeerverification(false)
        request.AddHeader("Content-Type", "application/json")
        request.SetUrl(url)  
        port = CreateObject("roMessagePort")
        request.SetMessagePort(port)
        request.SetPort(port)    
        timer = createobject("roTimeSpan")
        timer.Mark()
        request.AsyncGetToString()
        while true
            msg = wait(0, port)
            if type(msg) = "roUrlEvent" then
                return "OK"
                exit while
            end if       
        end while
end function

Please advice. How to reuqest thes type of URLs in RokuSG?
Tags (1)
0 Kudos
1 REPLY 1
squirreltown
Roku Guru

Re: How can pass roAssociativeArray in URL parameters?

GetFunction("http://mydomain.com/webservices/webservices.php?route=option&custom_option="+"[{'option_id' : '7', 'option_value': 24}]")



Obviously I can't test it but this doesn't throw a syntax error like yours did.
Kinetics Screensavers
Tags (1)
0 Kudos
Community is Temporarily in Read-Only Mode!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!