Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle /device/:id/action/:command POSTs? #476

Open
thoho opened this issue Dec 4, 2017 · 1 comment
Open

Handle /device/:id/action/:command POSTs? #476

thoho opened this issue Dec 4, 2017 · 1 comment

Comments

@thoho
Copy link

thoho commented Dec 4, 2017

Trying to get her to talk to my API (Fibaro HC2 home automation)...
The Fibaro API wants a POST to be made on a resource instance with an an action name to have that resource execute a command. Have not found a way to create a custom instance method that sends a POST with the id. Any suggestions?

Eg. POST http://my.ip:80/api/devices/205/action/turnOff with empty body

@thoho
Copy link
Author

thoho commented Dec 5, 2017

Solved this with (instance method)
self.class.post_raw("devices/#{id}/action/#{action}")
Not a solution I'm proud of but seems to do the job. Probably the API that should have a better wat to express "actions" on resources....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant