OpenLightingProject / ola

The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
https://www.openlighting.org/ola/
Other
638 stars 202 forks source link

JSON API - set_dmx not working ? #672

Open jkaan opened 9 years ago

jkaan commented 9 years ago

Whenever I try to POST to /set_dmx with any data I get no response.

I've tried HTTPie (https://github.com/jakubroztocil/httpie) which returns a connection aborted error.

I've also tried Postman which returns this: Could not get any response This seems to be like an error connecting to http://192.168.101.254:9090/set_dmx. The response status was 0.

The actual data I'm sending is this: u=1 d="2,5,5"

peternewman commented 9 years ago

@jkaan I'm running OLA 0.9.5 as a deb package, and the code here works fine for me: https://wiki.openlighting.org/index.php/OLA_JSON_API

Can you test that Perl code, then we can try and narrow down what's happening.

jkaan commented 9 years ago

That code is also working for me. How's it possible that it's not working with the above two programs ?

nomis52 commented 9 years ago

Can you take a tcpdump of the connection and see what the difference between the two are.

On Thu, Mar 12, 2015 at 3:50 PM, Joey Kaan notifications@github.com wrote:

That code is also working for me. How's it possible that it's not working with the above two programs ?

— Reply to this email directly or view it on GitHub https://github.com/OpenLightingProject/ola/issues/672#issuecomment-78494720 .

peternewman commented 9 years ago

If you give the HTTPie or postman command lines you're using, it may be someone can help you diagnose it.

jkaan commented 9 years ago

I might have figured out the issue. The call fails if I sent along JSON like this

{
    u: 1.
    d: "0,1,2,3,4,5,6"
}

However if I sent the data in a format which is equal to POSTing a form then it works. This seems an issue to me because if the API doesn't support the JSON format it should return some sort of error ?

daveol commented 9 years ago

correct. /set_dmx works with form formatted post query's not json.

nomis52 commented 9 years ago

We really need to redo the entire JSON api.

daveol commented 9 years ago

a summary of what needs to happen for the issue to close: POST requests have to accept json input, all GET requests already return json I believe

daveol commented 8 years ago

I have looked, and this might be impossible with the library we currently use (libmicrohttpd). Since there is no way (as far as I can see) to extract the Json posted to the api