Hi,
I work in a Arduino IoT Cloud project, with my NodeMCU (ESP8266) board.
All is working, my need now is making an http POST call to my custom API server.
I can't find a solution:
is there a function in Arduino IoT Cloud framework to make a POST request? I think I can't use ESP8266HTTPClient because it uses own WiFi client
as an alternative, can I make a custom webhook (not those official supported: iftt, google api, zapier, cloudfunctions)?
Could you please clarify if you want to make the HTTP POST from the sketch or from the IoT Cloud?
If you want to send it from the sketch, there are plenty of libraries that you can use to implement that. I would suggest using ArduinoHttpClient, but the one you are using would work too.
If you want the cloud to send the HTTP POST, you can use webhooks. You can create your own webhook (the link is in the bottom side of the Things tab), it is not mandatory to use the ones you have mentioned (IFTTT, Google, ...). Just write the URL of your endpoint in the box "Webhook URL". You can check this tutorial.
Hi @dbeamonte_arduino ,
my need was make a REST call (POST) from IoT Cloud.
I updated my first post to notify I successfully made a POST call with ESP8266HTTPClient library.
" it is not mandatory to use the ones you have mentioned (IFTTT, Google, ...). Just write the URL of your endpoint in the box "Webhook URL" . You can check this tutorial."
Is it not mandatory to use the ones in the list? I'm trying to use a custom webhook url but "set webhook" button keeps locked (I read another user post having same issue)
I attach my screenshot ("set webhook" button keeps disabled, it becames enabled only for example if my url starts with https://maker.ifttt.com/trigger/xxx maybe there is a regex to check textbox content @eclipse1985?)
Hey @lewixlabs !
Yes, you are right. Apologies for that . Custom webhooks is a feature not currently available. It's on our backlog but we don't have an ETA for it.
So, I guess that the only solution for you would be, either to use the client from the sketch (you have already done that) or to use any of the allowed platforms to resend you the event to your endpoint.
@dbeamonte_arduino no problem! And thank you for your suggestions anyway.
Yes using httpclient library for 8266 I suspect some instances would be in conflict, so my next idea as you said is using ifttt as bridge to receive a webhook and forward content as new webhook to my internal server (raspberry ).