httpGet calls to Kepware REST API - IOError: Unexpected end of file from server

I need some help with / Post

Background -
Ignition 7.9.10
Kepware 6.6.350.0

When I send the following
r =“ Tower/”,username=“XXXXXXXXXX”)

It returns - “IOError: Unexpected end of file from server”

however when I send
r =“",username="XXXXXXXXX”)

I get a valid response from Kepware.
Here’s the strange part… When I use Postman to send Get and Post calls everything works fine.
I can post the responses from Potman but excluded them for now as they are extremely lengthy.

Maybe you can spot the difference between Postman and the call that doesn’t work using Wireshark?

I was really trying to avoid packet capture…
I’ll fire up WireShark… Let you know what I find…

“IOError: Unexpected end of file from server” means the server (or something else) closed the connection for some reason. Since you can successfully make a request to a different URI it’s probably not something else, like a firewall or AV, and it’s KSE doing it for some reason.

If there were any logs to indicate why they’d be in KSE, not Ignition, so a packet capture seems like an easy next step.

Yep… Packet Capture Done…
Here’s what I found…
If I send with %20 in the spaces I get get a response…“",username="XXX”)

If I send with spaces I get the error…“ Tower/devices/Testing The API/meter_groups/”,username=“XXX”)


Not a huge deal I can just run replace(" “,”%20") on my url strings before passing them into the argument.

You might be able to use python’s urlencode function:

You’ll have to see if it’s actually part of the version of Jython we ship though.

1 Like

I was kinda expecting the function call to format the url properly?
The doc just says to pass it a url…
All though the second code snippet does have the %20 in the url…

Any chance we could have it put in as a bug…
Honestly I’m surprised no one else has ever had this issue…
Must not be a commonly used function. - Or I’m just a moron

It’s very commonly used, but spaces in URLs are less common I guess.

and FWIW, a string with spaces in it is not technically a URL, because URLs cannot contain spaces.

Confirmed - Moron Status… :stuck_out_tongue_winking_eye:

I do think it would be nice if it URL-encoded things for you… but then if someone passed an already encoded / proper URL, it would get double-encoded…


Well thanks for the help Kevin…