When calling this test function, the output of my logger is showing there are no parameters.
I’m going a bit nuts here, can someone point out where i’m going wrong sending parameters to the endpoint?
I’ve tried both the system.net.httpClient and system.net.httpPost in-built functions, both providing same issue.
I did observe a small error in our docs page for system.net.httpClient() regarding redirect_policy. It defaults to “NEVER” (not “NORMAL”) when unspecified. That is now corrected.
I think you’re probably going to run into problems trying to send all of that through as URL parameters. It seems more apropos to do a POST with a request body. That said, I was able to mock this up successfully:
And another discovery… probably obvious to someone who deals with HTTP requests a lot, but the reason my parameters weren’t getting sent to the endpoint correctly was due to invalid formatting of the date variables. It seems obvious in hindsight, but you cannot send a parameter string that looks like this:
IOError: Server returned HTTP response code: 400 for URL: http://172.20.7.94:8088/system/webdev/ERP_Test/volCompliance?pfmWidthID=200&pfmLengthID=4050&pfmStartDate=2022-08-20 00:30:00&pfmVolume=0.457&pfmLocationID=WDM&pfmGradeID=-ABC&pfmEndDate=2022-08-27 10:30:00&pfmGroupID=GROUP1&pfmThickID=50
Happy days if you format the date strings in a more URL friendly way such as:
Yes that was the problem… funny characters in the URL.
I would like to do a POST with request body but i seem to have forgotten how to do that. I think i did it in Javascript in some other project, but struggling a bit atm to recall it.
Also, if you do want to use URL params, system.net.httpClient will encode them for you, as long as the params object you provide is a dictionary and not pre-encoded JSON like you were doing. If you encode it yourself you are responsible for URL escaping the contents.
Ok, and presumably if using system.net.httpPost, using the postData and sending as a json encoded string does the equivalent?
Struggling to get system.net.httpClient working at the moment but i think i have enough to go by at the moment.
EDIT: Managed to get the data coming in properly using httpPost, and postData. Values no longer coming through as tuples like they did when sent as URL parameters…
I vaguely remember this being an issue on my other project too actually…