Sending Get request

Primary tabs

Hello! I'm sending get request. When send the request bellow 

Set httprequest=##class(%Net.HttpRequest).%New()
Set httprequest.Server=url
Do httprequest.Get("/"_par1_"/"_par2)

 Set statusCode = httprequest.HttpResponse.StatusCode

I get http status 200, but should get 410 status. Since the parameters passed are not valid. 

If I send request differently as below, I get http status 410, which is correct. 

Do httprequest.Get("/2019/0912")

What is the difference between these two requests Do httprequest.Get("/"_par1_"/"_par2) and Do httprequest.Get("/2019/0912")?


Remember about the second parameter in methods like Get and Post, which named test, which you can use for debugging purposes.

 If test is 1 then instead of connecting to a remote machine it will just output what it would have send to the web server to the current device, if test is 2 then it will output the response to the current device after the Get. This can be used to check that it will send what you are expecting.

did you verify if  par2 is really "0912" (leading zero) and not just 912

Thank you!

You are right, I checked the request, zeros are not displayed. How to send zeros in request ?

GET /201506/91001?PAGE=INDEX HTTP/1.1

must be


You already using concatenation, it, means, that you lost leading zero, somewhere before. You may have some arithmetic operations with your parameters, which will case to lose those zeros.

is it possible that "par1" and "par2" don't contain the values you think they do.  I would start there and confirm that par1 = "2019" and par2 = "0912"