Stephen Wilson · Sep 14, 2018

How do I process queryString parameters in a HttpGet Request in a %CSP.REST page?

So by queryString I mean name-value pairs passed  in as part of the URL. Currently my service works when called like this

What would I need to change so I can call it like this?

0 350
Discussion (2)1
Log in or sign up to continue

Class Rest.EmailSvc Extends %CSP.REST

XData UrlMap [ XMLNamespace = "" ]
    <Route Url="/TesteQuery/" Method="GET" Call="TesteQueryString"/>

ClassMethod TesteQueryString() As %Status
    Set tSC = $$$OK
    If 'tSC Quit tSC       
    Set tProxy = ##class(%ZEN.proxyObject).%New()
    Set tProxy.Discipline = $Get(%request.Data("Discipline", 1))
    Set tProxy.TestCode = $Get(%request.Data("TestCode", 1))
    Set %response.ContentType = "application/json"
    set %response.Status = 200
    Do tProxy.%ToJSON()
    Quit tSC