HTTP POST requests
Posted: 03 Jan 2021, 22:45
I was successfully using IRControl to control a device with HTTP GET requests such as:
192.168.175.51:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Input.Down","id":1}
After updating that device, it now requires HTTP POST requests. I've gotten the following to work from two other programs, but it fails in IRControl.
192.168.175.51:8080/jsonrpc (in the URL field)
{"jsonrpc":"2.0","method":"Input.Down","id":1} (in the Content field)
The stacktrace shows:
java.io.FileNotFoundException:
http://192.168.175.51:8080/jsonrpc
com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
ch.cec.ircontrol.o.i.a(Unknown Source:177)
ch.cec.ircontrol.o.i.a(Unknown Source:3)
ch.cec.ircontrol.setup.activity.p$h.run(Unknown Source:150)
ch.cec.ircontrol.d0.n$c.run(Unknown Source:25)
What am I missing? I feel like maybe it needs "Content-Type:application/json" but I'm not sure how to include it.
192.168.175.51:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Input.Down","id":1}
After updating that device, it now requires HTTP POST requests. I've gotten the following to work from two other programs, but it fails in IRControl.
192.168.175.51:8080/jsonrpc (in the URL field)
{"jsonrpc":"2.0","method":"Input.Down","id":1} (in the Content field)
The stacktrace shows:
java.io.FileNotFoundException:
http://192.168.175.51:8080/jsonrpc
com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
ch.cec.ircontrol.o.i.a(Unknown Source:177)
ch.cec.ircontrol.o.i.a(Unknown Source:3)
ch.cec.ircontrol.setup.activity.p$h.run(Unknown Source:150)
ch.cec.ircontrol.d0.n$c.run(Unknown Source:25)
What am I missing? I feel like maybe it needs "Content-Type:application/json" but I'm not sure how to include it.