toddaustin07 / edgebridge

Forwarding Bridge Server for SmartThings Edge drivers
Apache License 2.0
39 stars 19 forks source link

How do we go about adding header information for on external API call? #4

Closed leftyfb closed 1 year ago

leftyfb commented 1 year ago

Previously I was using webcore to make a call to IFTTT maker events when a button was pressed. The header is all json if that makes things easier.

toddaustin07 commented 1 year ago

What are you using to send the request and what exactly do you mean by “header”? HTTP headers are not JSON formatted.

leftyfb commented 1 year ago

curl -X POST -H "Content-Type: application/json" -d '{"value1":"2023-01-12","value2":"15:38:00","value3":"=((DATEDIF(A2,INDIRECT(\"A\"&ROW()),\"D\")/2)-ROW())"}' https://maker.ifttt.com/trigger.........

That is what I was sending before with webcore.

toddaustin07 commented 1 year ago

I’m confused. If you are using curl, than why do you need edgebridge??

Edgebridge is for Edge drivers running on a hub, like my webrequestor or HTTP Devices drivers.

HTTP header information is provided in those drivers’ device settings and sent as a standard HTTP request.

leftyfb commented 1 year ago

I was using curl because that's what webcore allowed me to do. Now I was hoping webrequestor could be used to send the same POST to IFTTT when I press a button, through the use of EdgeBridge. But I can't figure out how to send the necessary headers along with the POST.

toddaustin07 commented 1 year ago

Ah ok. That’s what I was asking… you’re using webrequestor.

Please refer to the webrequestor README. It shows you how to configure the url, headers, and body for the request: https://github.com/toddaustin07/webrequestor

Be careful of using quotes: be sure the are the “straight” kind and not the left/right style.