Hi,
I'm making a call to a REST API of a system monitoring server.
I'm querying event data over the last month to determine server uptime.
There are event types of 0,1,2,3 ... and to show all, the query should have
When using URI, I try
oURI = Openedge.Net.URI:Parse(ipcURL).
oURI:Path = ipcPath.
oURI:AddQuery("eventtype","0").
oURI:AddQuery("eventtype","1").
oURI:AddQuery("eventtype","2").
oURI:AddQuery("eventtype","3").
The resulting URL only has the ?eventtype=3 , as the AddQuery does not seem to handle duplicates, and the last one added trumps the rest.
Is there a recommended method to use the URI object to add duplicate query names, to allow multiples to appear.
Thanks
Mark
The URI stores query string keyed off the name (hence no dups). The URI (and the rest of the HTTP client) aims to be HTTP spec-compliant. However, the URI spec ([View:https://tools.ietf.org/html/rfc3986#page-23:550:50]) does not define the behaviour of the query string and so we had to choose an approach, and decided on unique query string names.
A similar discussion is at [View:https://stackoverflow.com/questions/1746507/authoritative-position-of-duplicate-http-get-query-keys#1746566:550:50]
If you have control over the server/URI then you could do something like
or you could send a single query parameter with complex data
or similar.
Just realised I missed the obvious, I'm running OE11.7.1.
The URI stores query string keyed off the name (hence no dups). The URI (and the rest of the HTTP client) aims to be HTTP spec-compliant. However, the URI spec ([View:https://tools.ietf.org/html/rfc3986#page-23:550:50]) does not define the behaviour of the query string and so we had to choose an approach, and decided on unique query string names.
A similar discussion is at [View:https://stackoverflow.com/questions/1746507/authoritative-position-of-duplicate-http-get-query-keys#1746566:550:50]
If you have control over the server/URI then you could do something like
or you could send a single query parameter with complex data
or similar.
Thanks Peter
I have no control over the server side, so I will redo my code to not use the URI ... it's a pain, as the URI was working fine for the other 99% of what I am doing :)
Mark
Hi Mark,
As an alternative, you could write your own HTTP class, using sockets. It's not that hard. And it gives you maximum flexibility.