companion icon indicating copy to clipboard operation
companion copied to clipboard

Enhancements to Generic HTTP module

Open empyfree opened this issue 6 years ago • 7 comments

Describe the feature Update the Generic HTTP module to include some useful options and functionality.

As per Facebook conversation with @josephdadams the current HTTP module is pre configured to send “Application/JSON” type headers.

https://www.facebook.com/groups/companion/permalink/2558279757723692/

It would be nice to have options here to change the format of the request.

I do not know enough about the varying types of HTTP requests to suggest what the options should be!?

Is this platform dependent (windows, mac, ..)? I do not believe so.

Usecases Simple and direct control of IFTTT webhooks service. My use case was to remotely turn on and off a fan as part of a sensory projection show (for my daughter!).

empyfree avatar Apr 22 '20 21:04 empyfree

Leaving this here instead of transferring to the generic HTTP module because we will need to modify the core REST library if we want to support changing the header type. It is application/json for GET, POST, and PUT by default. I recommend we implement a drop-down and at least include:

  • application/json
  • application/x-www-form-urlencoded
  • application/xml
  • text/html

I don't see reason to add them all.

josephdadams avatar Apr 22 '20 23:04 josephdadams

I support this. It would allow us to control OpenHAB from companion.

noctividus avatar Aug 22 '20 05:08 noctividus

I would support this as well. I'm currently replicating the ProPresenter Scoreboard web remote in companion and while I'd love to create it as a module and submit it for everyone, it needs to send form data in a POST and not JSON (again mimicking the web remote because the API doesn't contain the same functions). Right now I'm limited to putting curl commands in the run shell path button action to make them talk.

jimmystuart avatar Sep 02 '20 20:09 jimmystuart

Yes, it would be really nice, if we have at least two options in connection-settings for generic http:

Base URL: http://openhab.local/rest/items/ Content-Type: text/plain

Default-Value for this Content-Type field could stay "application/json" but with a possibility to change it. This could be a minimal solution to support openHAB.

magicofit avatar Nov 17 '21 18:11 magicofit

These PR's should take care of it:

https://github.com/bitfocus/companion-module-generic-http/pull/18

and #1790

josephdadams avatar Nov 18 '21 00:11 josephdadams

I implemented this. With help from @estilles :)

josephdadams avatar Nov 18 '21 03:11 josephdadams

Thanks @josephdadams this few lines transformed my Streamdeck to a complete smarthome interface. :)

magicofit avatar Nov 22 '21 05:11 magicofit